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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.