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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
percy83
Frequent Visitor

Need help with comparable summing of sales

Hi all,

 

I need some help figuring out how to sum sales for only comparable units. 

 

The definition of "comparable" is when a store unit has sales generated in an equivalent time period from last year.

 

The report I am building has slicer that defines the selected time period that will be used as a benchmark.

My model is a star schema with sales, date and store info

 

Super easy example is that if the bench slicer has the value "7" selected the store has to be open for at least 365 days + 7 days (or what every I select in the bench slicer) . 

 

 

Bench slicer = 

Sales trend days range = IF(HASONEVALUE(PeriodSlicer[Days]);VALUES(PeriodSlicer[Days]);COUNTROWS(dDate))

 

Opening date is  dStoreInfo[OpeningDate]

Sales is a measure [Sales]

 

Thanks for any help I can get! 

Regards

 

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @percy83 ,

Maybe you can take a look at the following blog to know more about use date function to achieve rolling total:

Time Intelligence "The Hard Way" (TITHW)  

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

Initially, it seems like you need datesytd

https://docs.microsoft.com/en-us/dax/datesytd-function-dax

Year  = CALCULATE(SUM(table[column]),DATESYTD('Date'[Date Filer]))
Last Year  = CALCULATE(SUM(table[column]),DATESYTD(dateadd('Date'[Date Filer],-12,MONTH)))

 

But from this, it does not seems like that. Can you put more light on the same?


@percy83 wrote:

 

Super easy example is that if the bench slicer has the value "7" selected the store has to be open for at least 365 days + 7 days (or what every I select in the bench slicer) . 

 

 

Bench slicer = 

Sales trend days range = IF(HASONEVALUE(PeriodSlicer[Days]);VALUES(PeriodSlicer[Days]);COUNTROWS(dDate))

 

Opening date is  dStoreInfo[OpeningDate]

Sales is a measure [Sales]

 

Thanks for any help I can get! 

Regards

 


Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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

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!

December 2024

A Year in Review - December 2024

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