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 SUM for single value from multi-select slicer

Hey guys,


hope you can help me out with this one.

I have a filter on month names (for simplicity let's imply the year is always 2022): 

SeekingHelp_0-1651139821362.png

And another slicer that allows period selection (MTD/Full). I'm already calculating the sum over the selected period.
Now, what I want to achieve is, that it is only calculating the sum 
and displaying it in a bar chart for the most recent month selected (e.g. March) when the user has MTD selected.


I did the calculation like that: 

CALCULATE (
SUM ( value ),
...
Dates[Year Month Number] = MAX ( Dates[Year Month Number] )
)

That works fine and I'm also able to show the whole sum over all months when the user selects "Full" in the other slicer.
Here is the problem: 
In a bar chart, Max ( Dates[Year Month Number] ) will always refer to the month the bar shows, so it displays all the selected months instead only the most recent one:
SeekingHelp_1-1651140395238.png

 


How do I achieve that it only shows March now?
 
Thanks for your help.
 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a measure

 

measure =

var _max = eomonth(maxx(allselected(Dates) , Dates[Date]) ,0)

return

calculate(sum(Table[Value]), filter(Dates, eomonth(Dates[Date],0) =_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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Create a measure

 

measure =

var _max = eomonth(maxx(allselected(Dates) , Dates[Date]) ,0)

return

calculate(sum(Table[Value]), filter(Dates, eomonth(Dates[Date],0) =_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
Anonymous
Not applicable

@amitchandak 

Thanks for your reply. Solved my issue with the MTD calculation. But I'm not able to transfer your example to a YTD calculation. If a user selects YTD, I want to show all months of the most recent year in a bar chart, despite the fact that the user might have not selected all months. How do I deal with this?


Appreciate your help!

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.