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
pdmU100
New Member

DAX Help/Weird Problem - Measures, MAX (using dates) and Conditional Formatting

Hi,

 

I wonder if you clever people can please help me..!

 

I'm trying to conditionally filter a row depending on if a row value matches the max value of that column. The conditioning is rule based. 1 = Colour the cell, 0 = don't colour.

 

Apologies for the awkawrd screen cuts below but I needed to withhold some columns data.

 

This works;

pdmU100_3-1645706341355.png

 

However I don't want the date hard coded as I'd then need to amend it each month, so I made a measure 'Current BDX Month' to return the 'max' date value in the source, which it does;

pdmU100_2-1645706190019.png

 

But when I combine the two, the formatting applies to everything..? What am I missing? I've tried playing with the column formatting, I've tried using MAXA, I've tried forcing the values to DATEVALUE or just VALUE, I've tried using a variables and nothing seems to work, it just applies the conditioning to all the rows..;

pdmU100_5-1645707266631.png

 

Even if I move the MAX measure into the conditioning measure it still doesn't work;

pdmU100_6-1645707757237.png

 

 

Just for the avoidance of doubt; all values in the reporting period column are dates and they all begin on day 01, its the months and years that change (i.e., 01 Nov 2021, 01 Dec 2021, 01 Jan 2022 etc).

 

Thanks for your help.

1 ACCEPTED SOLUTION

There may be filters applied to other columns than just the [Reporting Period (Start Date)] column. Try removing that column from the REMOVEFILTERS so you're just left with REMOVEFILTERS('ALL')

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

I think when you're calculating the max value for the date it is doing that within a row context which is filtering the date to just that month, so the max value will always equal the current value. You need to remove the filters when you're doing the calculation, so

Current BDX Conditioning =
var maxDate = CALCULATE(
MAX( 'ALL'[Reporting Period (Start Date)],
REMOVEFILTERS( 'ALL'[Reporting Period (Start Date)]
)
RETURN IF ( SELECTEDVALUE( 'ALL'[Reporting Period (Start Date)]) >= maxDate, 1, 0 )

Hi John,

Thanks, thats an  interesting thought. Never considerd their might be inherited filers on the rows already, unfortunately it doesn't seem to work! 

pdmU100_0-1645720861193.png

I'll keep playing about with it.

There may be filters applied to other columns than just the [Reporting Period (Start Date)] column. Try removing that column from the REMOVEFILTERS so you're just left with REMOVEFILTERS('ALL')

Perfect - did the job - thanks so much 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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