Hello,
I need 3 measures that will give me the cumulative total for the current week, current month and current year.
I’ve got the standard cumulative total calculation to start off with :
Cumulative Sales =
CALCULATE( [Total Sales];
FILTER( ALL( Dates[Date] );
Dates[Date] <= MAX( Dates[Date] ) ))
My other key measure is Today’s date : Today Date = TODAY()
In my graph, I will only have the product name. For a product, I need to know the cumulative total for the current week, month and year in regards to today’s date.
This is where I am stuck. How can I integrate my measure “Today Date” into the standard cumulative total to calculate the Total Sales for each measure - ie current week, current month, current year?
I’m using the Date dimension provided in the course,
Alternatively you could expand the Date dimension table with some Offsets, that way you can easily filter your Date table by current week, month, quarter or year because they will be equal to 0.
Here’s the M code to create these offsets. Please note that for the last line of your current code you’ll need to add a comma at the end and copy its name, followed by these lines where you’ll paste the name in place of YourPreviousStepName on the first line
Hi @Fiona, A response to this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!