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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Sum records that are the previous year to slider date selection

Hi

 

Does enyone know a way that I can show the sum of a value based on a previous year to users slider selection (e.g. user selects 1st Oct 2020 to 4th Nov 2020 I would like to calculate 1st Oct 2019 to 4th Nov 2019). The results must also be able to be filtered by dimensional selections and displayed in table with dimensional records as the rows.

 

This is based on a star schema data structure with date, fact and other dimensional tables (fact can be joined to date via key or date fields).

 

I have previously tried posting the specific challange I am facing with no luck so I thought I'd see if someone can help me with the concept first and then I will design my solution around it.

 

Any help would be greatly appreciated.

 

For those that are interested, this is my original post. https://community.powerbi.com/t5/Desktop/Prior-year-sales-based-on-slider/m-p/1763135#M691720 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a measure like this with date table, slicer should be on date table

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a measure like this with date table, slicer should be on date table

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak Thank you this is the solution.

 

I have actually tried this before but had the table join Cross filter direction set to both. Changing them to Single cracked it.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.