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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

DAX calculation

KSC_0-1652881292554.png

 

In the above table i want a column "Overall Status" next to Status, which should show 'Pass' or 'Fail' for each Name.
Condition : Show 'Pass' only if the person have Pass in all subject else show 'Fail' in "Overall Status"

1 ACCEPTED SOLUTION

Hey @Anonymous ,

 

sure, you can expant the criteria for other cases.

You could separate them with the double pipe "||" or you use the IN operator:

Overall Status =
IF (
    CALCULATE (
        COUNTROWS ( MyTable ),
        ALLEXCEPT ( MyTable, MyTable[Name] ),
        MyTable[Status] IN { "Fail", "N/A", BLANK () }
    ) > 0,
    "Fail",
    "Pass"
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic
 

View solution in original post

10 REPLIES 10
rohit_singh
Solution Sage
Solution Sage

Hello @Anonymous ,

Try this calculated column in DAX :

rohit_singh_0-1652882208234.png

Overall Status =

var _grades =
CALCULATE(
CONCATENATEX(VALUES(Grades[Status]), Grades[Status]," , "),
ALLEXCEPT(Grades, Grades[Name])
)

RETURN
if (CONTAINSSTRING(_grades, "Fail"), "Fail", "Pass" )
 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊

Anonymous
Not applicable

Hi @rohit_singh 
In the above scenario i also want to check if any "Status" value for the "Name" is blank or N/A then also "Overall Status" should show "Fail"

Note
: blank is not string, its just empty column.

Anonymous
Not applicable

can you please confirm what should i put at highlight text
if (CONTAINSSTRING(_grades"Fail"), "Fail""Pass" )

Hi @Anonymous ,

_grades is a a variable that we have created. 

var _grades =
CALCULATE(
CONCATENATEX(VALUES(Grades[Status]), Grades[Status]," , "),
ALLEXCEPT(GradesGrades[Name])
)
 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊

Anonymous
Not applicable

Big Thank
just last help if its possible to show only one value for each Name in Overall status
Currently its showing for each status row.

For each name there should be only one Overall status value, not repeating values.

KSC_0-1652887891113.png

 

selimovd
Super User
Super User

Hey @Anonymous ,

 

as I understood you want it as a calculated column.

Then the following approach would work:

Overall Status = 
IF (
    CALCULATE (
        COUNTROWS ( MyTable ),
        ALLEXCEPT ( MyTable, MyTable[Name] ),
        MyTable[Status] = "Fail"
    ) > 0,
    "Fail",
    "Pass"
)

 

The result would look like that:

selimovd_0-1652881904182.png

 

You could also solve that with a measure.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

 

Anonymous
Not applicable

Hi @selimovd 
In the above scenario i also want to check if any "Status" value for the "Name" is blank or N/A then also "Overall Status" should show "Fail"

Note
: blank is not string, its just empty column.

Hey @Anonymous ,

 

sure, you can expant the criteria for other cases.

You could separate them with the double pipe "||" or you use the IN operator:

Overall Status =
IF (
    CALCULATE (
        COUNTROWS ( MyTable ),
        ALLEXCEPT ( MyTable, MyTable[Name] ),
        MyTable[Status] IN { "Fail", "N/A", BLANK () }
    ) > 0,
    "Fail",
    "Pass"
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic
 

Hi @Anonymous 

 

I'd like to make a small modification based on @selimovd 's solution. Replace BLANK() with "". 

vjingzhang_0-1654242129242.png

 

Best Regards,
Community Support Team _ Jing

Samarth_18
Community Champion
Community Champion

HI @Anonymous ,

 

Create a column as below:-

 

Overall status = 
    var result = COUNTROWS(FILTER('Table','Table'[status] = "Fail" && 'Table'[Name]= EARLIER('Table'[Name])))
    return IF(result>0,"Fail","Pass")

 

Output:-

Samarth_18_1-1652881885247.png

 

Regards,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.