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
Anonymous
Not applicable

Dax - Max date by Month

I have a table that is tracking weekly snapshots for Monthly Sales Forecast. Based on the month that is displayed, I want it to show the data for the last snapshot. I assume it needs to use some form of MAX. Right now I'm working with a custom field that is adding a flag for the max Forecast Date:

MaxForecastDate = if(max('Monthly Forecast'[ForecastDate])='Revenue Monthly Forecast'[ForecastDate],1,0)
 
However, I think I need this to be a measure so it'll be dynamic based on the month I have displayed (Report filters by month, so it's fine for this month (Sept) because the MaxForecastDate =1 where ForecastDate=9/2/20, but if I switch to last month it just shows blank - no MaxForecastDate=1 for any of the August forecast records). 
smileamile_0-1599167656994.png

 

 
1 ACCEPTED SOLUTION

@Anonymous 
You need to check the max forecast date for each period, try create this column. 

 

Column = IF([Forecast Date]=CALCULATE(MAX([Forecast Date]),ALLEXCEPT('Table','Table'[Period])),1,0)
maxforecast.JPG
 
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Can you share sample data and sample output in table format?

Anonymous
Not applicable

@amitchandak  @Pragati11 Here is what I have and what I'm looking for (not sure how to put data in a sample output table). For each period, I need the max Forecast Date.

smileamile_0-1599138503238.png

 

 

@Anonymous 
You need to check the max forecast date for each period, try create this column. 

 

Column = IF([Forecast Date]=CALCULATE(MAX([Forecast Date]),ALLEXCEPT('Table','Table'[Period])),1,0)
maxforecast.JPG
 
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Can you share additional details like sample data, screenshots, etc.?

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.