Search code examples
powerbiconditional-statementsdaxpowerbi-desktop

Creating a conditional column in DAX based on 3 other columns


I've created new columns with a condition tied to them before, but typically it was just based on one other column. Here's where I'm suck:

Package Software Status
Package1 Software1 Complete
Package1 Software2 Ready
Package1 Software3 Complete
Package2 Software1 No Start
Package2 Software6 Ready
Package3 Software4 Complete

So a "Package" is a group of Software titles bundled together. I need to create a 4th column based on this criteria: If All Software Titles in a Package is in the Complete Status, then TRUE, if not then FALSE.

I can clarify further if needed because it doesn't feel like I'm explaining it clearly enough.

I've tried multiple IF statements, but to no avail. I figured there's got to be an easier way to do it.


Solution

  • Have a go with:

    PackageComplete = 
      var cnt =
        COUNTROWS(
          FILTER(
            'PackageTable',
            'PackageTable'[Package] = EARLIER(PackageTable[Package]) &&
            'PackageTable'[Status] <> "Complete"
          )
        )
      return IF(cnt > 0, FALSE(), TRUE())