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

Best practice in bench:ing two custom time periods

Hi,

 

I have this measure that is harvesting a day range ([Selected trend range]) from a slicer and sum sales for that given period.

 
Trend sales =
CALCULATE([Total sales CC];
FILTER(dStoreInfo;
[Last imported date] - dStoreInfo[Opening Date] - 365 - [Selected trend range] >= 0);
FILTER(dDate;
dDate[Date] > [Last imported date] - [Selected trend range] && dDate[Date] <= [Last imported date]))

 

Problem is that I only want to sum the sales for stores that are comparable. That logic is defined as:

 

FILTER(dStoreInfo;
[Last imported date] - dStoreInfo[Opening Date] - 365 - [Selected trend range] >= 0)
 
The dates are defined as per below.
FILTER(dDate;
dDate[Date] > [Last imported date] - [Selected trend range] && dDate[Date] <= [Last imported date]))
 
 
What is the best way to make a measure that sums the corresponding period for the previous year. 
 
I tried with using =CALCULATE([Trend Sales];SAMEPERIODLASTYEAR(dDate[date])) but that did not work. I guess it turns back both my sales date and the compareable date. What is the best pratice to solve something like this? 
 
Thanks!
1 REPLY 1
v-diye-msft
Community Support
Community Support

Hi @percy83 

 

You might consider creating pbix file that will contain some sample data, upload the pbix to onedrive or dropbox and share the link to the file. Please do not forget to describe the expected results based on this sample data.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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