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
Richsellars
New Member

Dynamic date measure

Hi All,

Ive come up with a scenario I can’t work the solution out for.

Essentially on a report slicer, I want to select a custom set of dates. What I want to see is on a report table is a list of items and total sales volume against them based on the slicer.

I can get a simple measure to work for the dates in question, however I can’t seem to find out how to build a measure to show the sales in the previous week and also the sales in the previous year as per the custom date filter.

I have got it working for whole weeks, but the problem is the data required is more specific than that.

Any thoughts greatly appreciated.

Thanks

Rich
3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Richsellars,

 

Have you solved your problem?

 

If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry

 
Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Richsellars,








By my test, the measure from Ashish_Mathur should help you get the sales in the previous year.

 

In addition, if you want to calcualte the sales in the previous week, you could try this measure below.

 

Measure = CALCULATE(SUM('Table'[Sales]),DATEADD('Table'[Date],-7,DAY))

If you still need help, please share some data sample and your desired output so that we could help further on it.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

See if this works for sales in previous year (for chosen slicer dates)

 

=CALCULATE([your measure],SAMEPERIODLASTYEAR(Calendar[Date]))

 

There should be a relationship from the Date column of your Sales Table to the Date column of your Calendar Table.


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

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.