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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cpmb
Frequent Visitor

Monthly Total and Year Running Total up Month selection on Slicer

Any ideas on how to get a monthly sum (decided by a Slicer selection) and a yearly sum (to the selected month on Slicer) to display on a table visual?

 

I have a Fact Table and Date Table, linked by Date.

 

Fact:

Location

Item

Date

Quantity

 

Date:

Date

Month

Year

 

My slicer is coming from the Date Table.

 

I attempted using the following measures:

[Month Quantity] = CALCULATE(SUM(Fact[Quantity]),FILTER(Fact,Fact[Item]=Fact[Item]&&Fact[Location]=Fact[Location]))

[Yearly Quantity] = CALCULATE([Month Quantity],ALL(Date[Month])

 

**Note: I also tried using the ALL function to filter by Month in the Fact table (ie: [Yearly Quantity] = CALCULATE([Month Quantity],ALL(Fact[Month]))

 

These result in the same value being displayed in my Table visual. I want to display these measures by Location and Item, hence the Filter function used in the [Month Quantity] measure. Any insight would be appreciated. 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Select a Year and Month in the 2 slicers that you have created from the Date Table.  Write these measures

Quantity = SUM(Fact[Quantity])

YTD Quantity = CALCULATE([Quantity],DATESYTD('Date'[Date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Select a Year and Month in the 2 slicers that you have created from the Date Table.  Write these measures

Quantity = SUM(Fact[Quantity])

YTD Quantity = CALCULATE([Quantity],DATESYTD('Date'[Date]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.