Hi,
This is my first post and first ever PBI Model, so please go easy on me
I have created a report that in the top visual, shows sales orders from the current week ending -365 days to the current week.
Here is the measure:
Orders TTM =
CALCULATE (
SUM ( emea_pbi_salesorders[Nett] ),
FILTER(
'Date',
'Date'[Date] >= TODAY() -365 &&
'Date'[Date] <= MAX('Date'[Date])
)
)
The report was received well, but I have been asked to modify it to show the the sum of the rolling 4 week value.
I created the following measure to accomplish this.
Sales Rolling 4 Weeks =
VAR Weeks =
DATESBETWEEN (
'Date'[Week Ending],
MAX ( 'Date'[Week Ending] ) -21,
MAX ( 'Date'[Week Ending] )
)
VAR Result =
CALCULATE ( [Total Sales], Weeks)
RETURN
Result
Total Sales is just
Total Sales = SUM(emea_pbi_salesorders[nettprice])
The issue I have, is trying to restrict the values to the previous 12 months.
I managed to fix it using an additional date table, but this was causing other issues, and I really dont think this was the way to proceed?
I also tried combining the two measures, but this caused the rolling 4 weeks to stop working.
Orders TTM2 =
CALCULATE (
[Sales Rolling 4 Weeks],
FILTER(
'Date',
'Date'[Date] >= TODAY() -365 &&
'Date'[Date] <= MAX('Date'[Date])
)
)
Could anyone point me in the right direction please?
I am very new (~ 6 weeks!) to Power BI and DAX, and don’t really have the vocabulary to ask Google.
Obfuscated model attached…
TTM Test.pbix (180.5 KB)
Thanks in Advance,
Kind Regards,
Mark