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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jrobb
New Member

Measure to capture MAX value based on filter selections

Hello,
 
I am a somewhat newbie to power BI and DAX, and trying to muddle my way through a particular issue.
 
I have a report set-up that displays a chart with Forecasted Sales $ over time.  I also have a filter for users to choose the specfic date(s) for which they want to display the data ("DateStamp").
 
I am trying to create a measure that will display the Total Sales $ value, of the Maximum selected DateStamp (latest date).  However, the result I am getting is a total of ALL Cumulative Sales $, for ALL date stamps selected. 
 
Do I have an error in my DAX statement? 
 
EndingCUM_ForMaxDtStamp = CALCULATE(SUM(FCST[FCST_Sales$]),
FILTER(FCST,FCST[DateStamp]=CALCULATE(MAX(FCST[DateStamp]),ALLSELECTED((FCST[DateStamp]))))
 
 
1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @jrobb 

 

Try this measure:

EndingCUM_ForMaxDtStamp =
VAR _Max_Date =
    MAX ( FCST[DateStamp] )
RETURN
    CALCULATE (
        SUM ( FCST[FCST_Sales$] ),
        KEEPFILTERS ( FCST[DateStamp] = _Max_Date )
    )

 

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @jrobb 

 

Try this measure:

EndingCUM_ForMaxDtStamp =
VAR _Max_Date =
    MAX ( FCST[DateStamp] )
RETURN
    CALCULATE (
        SUM ( FCST[FCST_Sales$] ),
        KEEPFILTERS ( FCST[DateStamp] = _Max_Date )
    )

 

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

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

This worked perfectly.  Thanks @VahidDM !

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.