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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Sum with 2 filters based on 1 selected date in the slicer

Hi Experts

 

I have a table of forecast with 2 columns for months, DemandMonth and SnapMonth (see below, all in date format), and the DemandMonth is linked to MonthDate in the time master (see below). The objective is to sum Value in forecast based on the selected Monthdate plus the related SnapMonth.

The 1st phase is simple, just sum the value of the month selected. I did a measure below which works.

Measure1 = CALCULATE(SUM('Forecast'[Value]),FILTER('Forecast',[DemandMonth]=SELECTEDVALUE('Time'[MonthDate])&&'Forecast'[SnapMonth]=SELECTEDVALUE('Time'[SnapMonth])))
However, when I try to sum for the previous month simultanesouly with measure below it returns nothing.
Measure2 = CALCULATE(SUM('Forecast'[Value]),FILTER('Forecast',[DemandMonth]=SELECTEDVALUE('Time'[-1MonthDate])&&'Forecast'[SnapMonth]=SELECTEDVALUE('Time'[-1SnapMonth])))
Look forward to your comments. Thanks
 
Forecast

yamacha_0-1611048927989.png

Time Table

yamacha_1-1611049149589.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , if they connected the sleected value is no a good idea , If the time table is disconnected

Try like 

Measure1 = CALCULATE(SUM('Forecast'[Value]),FILTER('Forecast',[DemandMonth] in values('Time'[MonthDate])&&'Forecast'[SnapMonth]=SELECTEDVALUE('Time'[SnapMonth])))

 

Measure2 = CALCULATE(SUM('Forecast'[Value]),FILTER('Forecast',[DemandMonth] In values('Time'[-1MonthDate]) && 'Forecast'[SnapMonth] in values('Time'[-1SnapMonth])))

 

Also explore userelationship, if you want to need one table at a time

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

https://www.youtube.com/watch?v=e6Y-l_JtCq4

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 , if they connected the sleected value is no a good idea , If the time table is disconnected

Try like 

Measure1 = CALCULATE(SUM('Forecast'[Value]),FILTER('Forecast',[DemandMonth] in values('Time'[MonthDate])&&'Forecast'[SnapMonth]=SELECTEDVALUE('Time'[SnapMonth])))

 

Measure2 = CALCULATE(SUM('Forecast'[Value]),FILTER('Forecast',[DemandMonth] In values('Time'[-1MonthDate]) && 'Forecast'[SnapMonth] in values('Time'[-1SnapMonth])))

 

Also explore userelationship, if you want to need one table at a time

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

https://www.youtube.com/watch?v=e6Y-l_JtCq4

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

Thanks@amitchandak, I tried to disconnect the time table with the forecast, and found it works!!!!

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.

Top Kudoed Authors