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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

if

i have two columns "Student ID" & "Status" in database, need a calculation to show colour on a card(Overall status) based on below conditions

 

Condition: IF all student have "Pass" status the show Green Colour
                   If any single student have "Fail" status the show Green colour

 

 

Student id Status
1Pass
2Fail
3Pass
4Pass
5Pass
1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Anonymous 

Create a measure like below for overall status:-

Measure 3 = if(COUNTROWS(FILTER('Table (3)','Table (3)'[Status] = "Fail"))>0,"Fail","Pass")

Now create a measure with below code and use it in conditional formatting:-

 

Measure =
IF (
    COUNTROWS ( FILTER ( 'Table (3)', 'Table (3)'[Status] = "Fail" ) ) > 0,
    "Red",
    "Green"
)

 

Output:-

Samarth_18_0-1644224152521.png

 

 

 

Thanks,

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

This POWER BI, reply in any Measure or New Column 
Adults_type =
IF(('all hotels'[adults] = 1 && 'all hotels'[children] = 0 && 'all hotels'[babies] = 0) ,"Single",
                    IF(('all hotels'[adults] = 2 && 'all hotels'[children] = 0 && 'all hotels'[babies]) = 0,"Couple",
                         IF(('all hotels'[adults] > 2 && 'all hotels'[children] = 0 && 'all hotels'[babies] = 0),"Group or Friends","Family"
                            )
                       )
                 )
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

Whether the advice given by @Samarth_18  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

Samarth_18
Community Champion
Community Champion

Hi @Anonymous 

Create a measure like below for overall status:-

Measure 3 = if(COUNTROWS(FILTER('Table (3)','Table (3)'[Status] = "Fail"))>0,"Fail","Pass")

Now create a measure with below code and use it in conditional formatting:-

 

Measure =
IF (
    COUNTROWS ( FILTER ( 'Table (3)', 'Table (3)'[Status] = "Fail" ) ) > 0,
    "Red",
    "Green"
)

 

Output:-

Samarth_18_0-1644224152521.png

 

 

 

Thanks,

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

amitchandak
Super User
Super User

@Anonymous ,

New measure =

var _color = countrows(filter(Allselected(Table), Table[Status] = "Fail"))

return

if(isblank(_color) , "Green", "Red")

 

Use this measure in conditional formatting using field value option

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.