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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Mous007
Helper IV
Helper IV

Task final status with multiple variables evaluation

Hi all,

 

I had a list of tasks and each task is linked to an Action and Finding. Some of the tasks as you see below can be linked to multiple actions and findings.

 

In order for a task to be closed, i need both the action and findings to be closed otherwise the task is still open. I haver used a simple switch function to create the final status column but it only evaluates each line seperatly without considering tasks with multiple actions or findings.

 

I am trying to write an expression that will evaluate the final task status taking into consideration both rules mentioned above (action and findings both closed).

 

The actual result i am aiming for is for e.g. :

Task ID =14909 = Open 

Task ID =46370 = Open 

Task ID =46883 = Closed

 

Would gladly appreciate if someone can help with the above or least guide me on how i can get the end result for each specific task taking into consideration the multiple variables involved to determine the end status.

 

Task IDAction IDFinding IDAction Closed?Finding Closed?FInal status
1490955NoNoOpen
1490966YesYesClosed
463703131NoNoOpen
463703232NoYesOpen
463703333YesYesClosed
468838484YesYesClosed
468838585YesYesClosed

 

Thank you in advance.,

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Hi, @Mous007 , you might want to try a measure in a calculated column,

 

Final Status = 
VAR __final =
    COUNTROWS (
        FILTER (
            FILTER ( Table1, Table1[Task ID] = EARLIER ( Table1[Task ID] ) ),
            Table1[Action Closed?] = "No" || Table1[Finding Closed?] = "No"
        )
    )
RETURN
    IF ( __final, "Open", "Closed" )

 

Screenshot 2020-11-22 231000.png

 

Alternatively, a measure also does the trick,

 

Final =
VAR __final =
    COUNTROWS (
        FILTER (
            FILTER ( ALL ( Table1 ), Table1[Task ID] = MAX ( Table1[Task ID] ) ),
            Table1[Action Closed?] = "No" || Table1[Finding Closed?] = "No"
        )
    )
RETURN
    IF ( __final, "Open", "Closed" )

 

Screenshot 2020-11-22 232636.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
Mous007
Helper IV
Helper IV

Thank you both for the support. Above approaches are all correct but I had some blanks and iteam i needed to take out so i used @CNENFRNL  calculated column approach as it was way easier for me.

 

Thanks to you both for the constructive posts.

CNENFRNL
Community Champion
Community Champion

Hi, @Mous007 , you might want to try a measure in a calculated column,

 

Final Status = 
VAR __final =
    COUNTROWS (
        FILTER (
            FILTER ( Table1, Table1[Task ID] = EARLIER ( Table1[Task ID] ) ),
            Table1[Action Closed?] = "No" || Table1[Finding Closed?] = "No"
        )
    )
RETURN
    IF ( __final, "Open", "Closed" )

 

Screenshot 2020-11-22 231000.png

 

Alternatively, a measure also does the trick,

 

Final =
VAR __final =
    COUNTROWS (
        FILTER (
            FILTER ( ALL ( Table1 ), Table1[Task ID] = MAX ( Table1[Task ID] ) ),
            Table1[Action Closed?] = "No" || Table1[Finding Closed?] = "No"
        )
    )
RETURN
    IF ( __final, "Open", "Closed" )

 

Screenshot 2020-11-22 232636.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

AlB
Community Champion
Community Champion

Hi @Mous007 

If you want a calculated column:

 

Final status =
VAR actionClosed_ =
    CALCULATE (
        COUNT ( Table1[Action Closed?] ),
        Table1[Action Closed?] = "No",
        ALLEXCEPT ( Table1, Table1[Task ID] )
    ) = 0
VAR findingClosed_ =
    CALCULATE (
        COUNT ( Table1[Finding Closed?] ),
        Table1[Finding Closed?] = "No",
        ALLEXCEPT ( Table1, Table1[Task ID] )
    ) = 0
RETURN
    IF ( actionClosed_ && findingClosed_, "Closed", "Open" )

 

or alternatively:

Final status =
VAR isClosed_ =
    CALCULATE (
        COUNT ( Table1[Action Closed?] ),
        FILTER (
            ALL ( Table1[Action Closed?], Table1[Finding Closed?] ),
            Table1[Action Closed?] = "No" || Table1[Finding Closed?] = "No"
        ),
        ALLEXCEPT ( Table1, Table1[Task ID] )
    ) = 0
RETURN
    IF ( isClosed_, "Closed", "Open" )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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