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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculate max date in a report with a slicer between date

Hi everyone and thanks for helpme.

I have a report with a slicer date (between), but in this page I have several graphics that only must show data for the max date of my slicer date:

ruz_lee_0-1598547560685.png

 

If the max date in the slicer is 27/08/2020, these graphics only must show data for this day.

The metric that Im using, do a distinct count of the number of incident for the max date:

 

ruz_lee_1-1598549753119.png

 

It seem that this metric run correctly in the donut and in the table, but not in the trend (chart), because calculate the max of the date but by field of the legend (CAUSE):

Capture.PNG

 

I found the error, because the char is sorted descending by this metric, but the chart seem not sorted, then I compared the data, and I checked for example that for Insurer 14, in the table show 4, but in the chart are 6, 1 storm, 3 other and 2 Hail, and so is because the metric is calculating the count distinct incident, using the max date by CAUSE using the range until 27/08/2020, and I would need the total max date showed in the slicer date like it was filtered just for the day 27/08/2020.

 

If I delete the field Cause of the legend in the chat object, the metric run correctly:

Capture2.PNG

Now, the Ins_14 only show 4 incidents, but I would need show the colour for these 4 incident by CAUSE.

 

How could I do it? Thanks

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , change the var calculation like and check

maxx(allselected(MotorOderGermany),MotorOderGermany[Date])

 

always have date table and use that in such cases

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , change the var calculation like and check

maxx(allselected(MotorOderGermany),MotorOderGermany[Date])

 

always have date table and use that in such cases

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

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

@amitchandakThanks a lot, I applied your change and now the trend char show the data correctly!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.