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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yoshlin
Regular Visitor

MAX Date filter

Good Day,

I have an issue where a DAX formula is not ouputting correctly. Essentially I wrote formulas to calculate the value difference of items from a previous month, which ouputs correctly. Now I want to filter on the MAX selected date (wrote this in DAX) for those values but it does not work.

yoshlin_0-1600155759355.png

 

1. The matrix output on the far left is correct
2. The table output in the middle via a DAX filter does not work ([Latest Month], [Date Checker]) Code can be found in PowerBI file
3. The table output on the right (manual filter) works perfectly.

I'm not sure where the formula is breaking.I believe it is somewhere along the lines because of the relationship between the two tables in PowerBI.

 

Let me know if I need to furnish more details.Please find the links to the excel base data and Power BI File that may assist.

 

Excel - https://www.dropbox.com/s/ifqq493hvw781ub/Test.pbix?dl=0

PowerBI - https://www.dropbox.com/s/8cmm6vpbpxwh0bo/Test.xlsx?dl=0



4 REPLIES 4
amitchandak
Super User
Super User

@yoshlin , Not checked your file. But you can have measure like ?

 

measure =
var _max = maxx(allselected(Date), Date[Date])
return
calculate([Value measure], filter(Date,Date[Date]= _max))

Hi @amitchandak,

 

Slightly confused on the [Value measure] syntax - is that self-referencing ?

 

I tried to do it this way to get my latest month to run a filter but it does not work. 

 

Latest Month =


VAR CurrentYearMonth =
 
MAXX(ALLSELECTED('tertiary vw_insights_ageing_profile'),'tertiary vw_insights_ageing_profile'[Date Link])
 
Return IF(max('tertiary vw_insights_ageing_profile'[Date Link]) = CurrentYearMonth,1,0)

 

@yoshlin , Try like

measure =

VAR CurrentYearMonth = MAXX(ALLSELECTED('tertiary vw_insights_ageing_profile'),'tertiary vw_insights_ageing_profile'[Date Link])
Return

   IF(format(max('tertiary vw_insights_ageing_profile'[Date Link]),"YYYYMM") = format(CurrentYearMonth,"YYYYMM"),1,0)

 

You can use today() in place of MAXX(ALLSELECTED('tertiary vw_insights_ageing_profile'),'tertiary vw_insights_ageing_profile'[Date Link]) , if needed

@amitchandak 

I've written it exactly as you typed and it is unfortuantely still not working.

 

Perhaps the attached PBI file might be of some use ?

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors