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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
hello-world
Frequent Visitor

Get last date in measure, with filters

Hi everyone,

 

How can I create a measure which gets the last/max date from another measure which is returning a max date with that has been filter, while plotting against a date axis?

My problem is: I want to plot one cumulative value for one specific date, which is determined as the last date using filters in the calculate statement. When I use MAXX, it still gives me back all the values since my x-axis uses dates.

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @hello-world  , 

 

According to your description, you could create two measures, One is used as cumulative value for maximum date,

and another is used to influence the x-axis. the following formula to create :

Step1: create a sum measure (The  [Measure]  here is that you mentioned from another measure which is returning a max date)

sum maxdate =

 SUMX(FILTER(ALL('table'),[Product]=MAX('table'[Product])&&[Date]<=[Measure]),[Sale Price])

Step2:  Create a flag measure

flag = IF(MAX([Date])=[Measure],1,0)

Step3: Apply the flag measure into filter and the final output is shown below

v-yalanwu-msft_0-1620206423802.jpeg

The final output is shown below:

 

v-yalanwu-msft_1-1620206423804.jpegand  v-yalanwu-msft_2-1620206423806.jpeg

 

  

Best Regards,
Community Support Team_ Yalan Wu
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

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi @hello-world  , 

 

According to your description, you could create two measures, One is used as cumulative value for maximum date,

and another is used to influence the x-axis. the following formula to create :

Step1: create a sum measure (The  [Measure]  here is that you mentioned from another measure which is returning a max date)

sum maxdate =

 SUMX(FILTER(ALL('table'),[Product]=MAX('table'[Product])&&[Date]<=[Measure]),[Sale Price])

Step2:  Create a flag measure

flag = IF(MAX([Date])=[Measure],1,0)

Step3: Apply the flag measure into filter and the final output is shown below

v-yalanwu-msft_0-1620206423802.jpeg

The final output is shown below:

 

v-yalanwu-msft_1-1620206423804.jpegand  v-yalanwu-msft_2-1620206423806.jpeg

 

  

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@hello-world , Not very clear. Can you explain

 

measure =
var _max = maxx(allselected('Date1'), 'Date1'[Date])

return
CALCULATE(SUM(Sales[Sales Amount]),filter(allselected('date'),'date'[date] <=max('date'[date]) && 'Date'[date] <= _max))

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors