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

Need Help with conditional formatting in DAX

Dear Users

i want to apply conditional formmating in powerBI same as shown in below table.

i want to highlight only 1 cell in entire matrics . i have tried top 1 and ranx functions but not able to achieve desired result.

thanks in advance.

 

Screenshot 2023-11-20 123245.png

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Dhrutivyasa-070 ,

 

supposing you have a data table like:

Year Month Value
2023 June 500000
2023 June 500000
2022 June 67
2023 July 90
2022 July 10

 

try

1) plot a matrix visual with year column, month column and a measure like:

Sum = sum(data[Value])

 

2) conditionally formatting the [Sum] field with a measure like:

Color = 
VAR _max = MAXX(ALLSELECTED(data), [Sum])
VAR _result = IF( [Sum] = _max, "Green")
RETURN _result

 

it worked like:

FreemanZ_0-1700465307354.png

 

for more info:

https://databear.com/changing-colours-using-dax-and-conditional-formatting-in-power-bi/

 

 

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

FormatMeasure=IF([Measure]=MAXX(SUMMARIZE(ALLSELECT(Table),Table[Year],Table[Month]),[Measure]),"green")

FreemanZ
Super User
Super User

hi @Dhrutivyasa-070 ,

 

supposing you have a data table like:

Year Month Value
2023 June 500000
2023 June 500000
2022 June 67
2023 July 90
2022 July 10

 

try

1) plot a matrix visual with year column, month column and a measure like:

Sum = sum(data[Value])

 

2) conditionally formatting the [Sum] field with a measure like:

Color = 
VAR _max = MAXX(ALLSELECTED(data), [Sum])
VAR _result = IF( [Sum] = _max, "Green")
RETURN _result

 

it worked like:

FreemanZ_0-1700465307354.png

 

for more info:

https://databear.com/changing-colours-using-dax-and-conditional-formatting-in-power-bi/

 

 

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.

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.