Forum Discussion
Rolling 12 WEEK Measure
- 5 years ago
Hi,
According to your description, I can roughly understand your requirement, I think you can achieve this using a rank column and a calculate column to get the rolling total, you can try my steps:
This is the test data model I created based on your sample pictures:
Create two calculated column in the main table like this:
week rank = RANKX('Fact_B2BSalesDiagnostic',[WeekStart],,ASC,Dense)rolling 12 week total = var _value= CALCULATE(SUM(Fact_B2BSalesDiagnostic[Shipped COGS]),FILTER(ALL(Fact_B2BSalesDiagnostic),[week rank]<=EARLIER(Fact_B2BSalesDiagnostic[week rank])&&[week rank]>=EARLIER(Fact_B2BSalesDiagnostic[week rank])-11)) return IF([week rank]<12,BLANK(),_value)Then you can get the rolling total for 12 weeks in the table like this:
Then you can create a table chart and a slicer to get the expected output like this:
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
According to your description, I can roughly understand your requirement, I think you can achieve this using a rank column and a calculate column to get the rolling total, you can try my steps:
This is the test data model I created based on your sample pictures:
Create two calculated column in the main table like this:
week rank = RANKX('Fact_B2BSalesDiagnostic',[WeekStart],,ASC,Dense)rolling 12 week total =
var _value=
CALCULATE(SUM(Fact_B2BSalesDiagnostic[Shipped COGS]),FILTER(ALL(Fact_B2BSalesDiagnostic),[week rank]<=EARLIER(Fact_B2BSalesDiagnostic[week rank])&&[week rank]>=EARLIER(Fact_B2BSalesDiagnostic[week rank])-11))
return
IF([week rank]<12,BLANK(),_value)
Then you can get the rolling total for 12 weeks in the table like this:
Then you can create a table chart and a slicer to get the expected output like this:
And you can get what you want.
You can download my test pbix file below
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Thank you very much!
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.