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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
PBInewuser
Microsoft Employee
Microsoft Employee

Conditional Column on Hierarchy

Hi there,

Please see the sample table below

When Status is "Failed" for any Contract No or Contract the outcome on New Column Should be "Failed"

Please advise a measure

 

Table.PNG

 

Thanks,

 

1 ACCEPTED SOLUTION
edhans
Community Champion
Community Champion

Hi @PBInewuser , 

 

You are using a few terms interchangably that are not the same thing.

 

A conditional column is a column in Power Query. I would generally recommend this is the way to go as you are changing the model with a new column, but if I am undersanding your question, you want it for any single contract number that has any status as failed, so Power Query isn't the way to go.

 

You are then asking for a new column, but then ask for a measure. I think you want a new column in a visual, not the model, and a measure is the way to go.

 

Final Status = 
VAR varFailedStatusCount =
    CALCULATE(
        COUNTROWS('Table'),
        REMOVEFILTERS('Table'[Date],'Table'[Status]),
        'Table'[Status] = "Failed"
    )
var Result = 
    IF(
        varFailedStatusCount > 0,
        "Failed",
        "Success"
    )
RETURN
    Result

 

That returns this:

edhans_0-1595549196373.png

Contract 1 is failed, but contract 2 has no falures, so the final status is Success.

 

My PBIX is here if you want to look at it.

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Community Champion
Community Champion

Hi @PBInewuser , 

 

You are using a few terms interchangably that are not the same thing.

 

A conditional column is a column in Power Query. I would generally recommend this is the way to go as you are changing the model with a new column, but if I am undersanding your question, you want it for any single contract number that has any status as failed, so Power Query isn't the way to go.

 

You are then asking for a new column, but then ask for a measure. I think you want a new column in a visual, not the model, and a measure is the way to go.

 

Final Status = 
VAR varFailedStatusCount =
    CALCULATE(
        COUNTROWS('Table'),
        REMOVEFILTERS('Table'[Date],'Table'[Status]),
        'Table'[Status] = "Failed"
    )
var Result = 
    IF(
        varFailedStatusCount > 0,
        "Failed",
        "Success"
    )
RETURN
    Result

 

That returns this:

edhans_0-1595549196373.png

Contract 1 is failed, but contract 2 has no falures, so the final status is Success.

 

My PBIX is here if you want to look at it.

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.