Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
andronachealin
Frequent Visitor

Calculated DAX column with multiple If statements

Hi all,

 

I would like to create a calculated column using DAX, titled Curriculum Status, that will apply the following logic:

  • For each User ID (column C), if all course IDs in column B are mapped to the curriculum in column A and if they have a Completed Course Status (column D) -> then add a Completed value in column E.
  • If the conditions above are not met -> then add a Incomplete value in column E.

The end results should look like this:

Example.PNG

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

I didn't understand this part " if all course IDs in column B are mapped to the curriculum in column A "  and it doesn't seem to matter for your desired result.

 

 

Curriculum Status = 
var s = CALCULATETable(values('Table'[Course Status]),ALLEXCEPT('Table','Table'[User ID]))
return if(concatenatex(s,'Table'[Course Status],",")="Completed",s,"Incomplete")

 

View solution in original post

4 REPLIES 4
wdx223_Daniel
Super User
Super User

=VAR _course=CALCULATETABLE(VALUES(sample[Course ID]),ALLEXCEPT(sample,sample[User ID])) VAR  _curri=CALCULATETABLE(VALUES(sample[Curriculumn ID]),ALL(sample),sample[Course ID] IN _course) VAR _status=CALCULATETABLE(VALUES(sample[Course Statues]),ALL(sample),sample[Curriculum ID] IN _curri,sample[Course Status]<>"Completed") RETURN IF(COUNTROWS(_status)>0,"Incompleted","Completed")

lbendlin
Super User
Super User

I didn't understand this part " if all course IDs in column B are mapped to the curriculum in column A "  and it doesn't seem to matter for your desired result.

 

 

Curriculum Status = 
var s = CALCULATETable(values('Table'[Course Status]),ALLEXCEPT('Table','Table'[User ID]))
return if(concatenatex(s,'Table'[Course Status],",")="Completed",s,"Incomplete")

 

@lbendlin True. I did not really need that condition.
Thanks for the solution. Works like a charm. Much appreciated.

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this column expression

 

Status =
VAR vIncompleteRows =
    CALCULATE (
        COUNTROWS ( Table ),
        ALLEXCEPT (
            Table,
            Table[User ID],
            Table[Curriculum ID]
        ),
        Table[Course Status] <> "Completed"
    )
RETURN
    IF (
        vIncompleteRows > 0,
        "Incomplete",
        "Completed"
    )

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.