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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Keks
Frequent Visitor

Remove filter on min date and keep max date

Hi everybodu,

 

I have a measure 'Turnover' = calculate(sum(analytic_line[amount]))

and i would like to have a new measure which take into account the max date but not the min date the user has selected (filter = range of dates).

 

I really don't find a solution. I try this but with no success : 

VAR MaxDate = max('analytic_line'[date])
RETURN
CALCULATE([Turnover],REMOVEFILTERS('analytic_line'[date]),'analytic_line'[date]<=MaxDate)
 
Can someone please help me?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you Idrissshatila and ajohnso2 

Hi, @Keks 

Based on your description, I've created the following sample data:

vjianpengmsft_0-1725425005806.png

In order for the maximum date selected by the user to affect the calculation of the measure, the minimum date is not. We need to create a calculated table with the following DAX expression to use as a date slicer:

Date = VALUES(analytic_line[date])

vjianpengmsft_1-1725425120258.png

vjianpengmsft_2-1725425160635.png

Then change your DAX expression to:

Measure = 
VAR _maxdate = MAX('Date'[date])
RETURN CALCULATE([Turnover], REMOVEFILTERS(analytic_line[date]),'analytic_line'[date]<=_maxdate)

Here are the results:

vjianpengmsft_3-1725425232468.png

vjianpengmsft_4-1725425242640.png

vjianpengmsft_5-1725425264358.png

I've provided the PBIX file used this time below.

 

 

Best Regards

Jianpeng Li

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

5 REPLIES 5
Anonymous
Not applicable

Thank you Idrissshatila and ajohnso2 

Hi, @Keks 

Based on your description, I've created the following sample data:

vjianpengmsft_0-1725425005806.png

In order for the maximum date selected by the user to affect the calculation of the measure, the minimum date is not. We need to create a calculated table with the following DAX expression to use as a date slicer:

Date = VALUES(analytic_line[date])

vjianpengmsft_1-1725425120258.png

vjianpengmsft_2-1725425160635.png

Then change your DAX expression to:

Measure = 
VAR _maxdate = MAX('Date'[date])
RETURN CALCULATE([Turnover], REMOVEFILTERS(analytic_line[date]),'analytic_line'[date]<=_maxdate)

Here are the results:

vjianpengmsft_3-1725425232468.png

vjianpengmsft_4-1725425242640.png

vjianpengmsft_5-1725425264358.png

I've provided the PBIX file used this time below.

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

THANK YOU !!!!

ajohnso2
Super User
Super User

New Measure = 
VAR MaxDate = CALCULATE(MAX('analytic_line'[date]), ALL('analytic_line'[date]))
RETURN
CALCULATE(
    [Turnover],
    'analytic_line'[date] <= MaxDate
)

Instructions not clear but this should get the max avaliable date in your data.

Idrissshatila
Super User
Super User

Hello @Keks ,

 

try this

New Measure = 
VAR MaxDate = LASTDATE('analytic_line'[date])
RETURN
CALCULATE(
    [Turnover],
    'analytic_line'[date] <= MaxDate
)


Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Thanks but it doesn't work 😞 

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.