monsoonnut
New Member
- Joined
- Jul 1, 2016
- Messages
- 13
Hi
I am working on a forecast accuracy report that runs weekly - I have a custom dates table ('SCMWEEK') that contains weeks with WEEK_IK being the Key.
[TABLE="width: 254"]
<tbody>[TR]
[TD]WEEK_IK[/TD]
[TD]WEEK[/TD]
[TD]YEAR[/TD]
[TD]YYYYWW[/TD]
[/TR]
[TR]
[TD]838[/TD]
[TD]4[/TD]
[TD]2015[/TD]
[TD]201504[/TD]
[/TR]
[TR]
[TD]839[/TD]
[TD]5[/TD]
[TD]2015[/TD]
[TD]201505[/TD]
[/TR]
[TR]
[TD]840[/TD]
[TD]6[/TD]
[TD]2015[/TD]
[TD]201506[/TD]
[/TR]
[TR]
[TD]841[/TD]
[TD]7[/TD]
[TD]2015[/TD]
[TD]201507[/TD]
[/TR]
[TR]
[TD]842[/TD]
[TD]8[/TD]
[TD]2015[/TD]
[TD]201508[/TD]
[/TR]
</tbody>[/TABLE]
This table is linked to my data table via the YYYWW column and I have created calculations for LW using the GFITW and all is working:
Accuracy Wk-1:=IF(HASONEVALUE(SCMWEEK[WEEK_IK]),CALCULATE([Accuracy],
ALL('SCMWEEK'),FILTER(ALL('SCMWEEK'),SCMWEEK[WEEK_IK]=VALUES(SCMWEEK[WEEK_IK])-1)),BLANK())
However, when I want to compare TY vs. LY I am running into problems due to the variable length of timeframes used, meaning I cannot just amend the -1 in the above formula to -52.
The model used means that when comparing with LY an extra week may need to be added or a week removed to keep the Yr on Yr comparisons aligned:
[TABLE="width: 335"]
<tbody>[TR]
[TD="colspan: 2"]Duplicate week[/TD]
[TD][/TD]
[TD="colspan: 2"]Week Removed[/TD]
[/TR]
[TR]
[TD]TY Week[/TD]
[TD]LY Week[/TD]
[TD][/TD]
[TD]TY Week[/TD]
[TD]LY Week[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]3[/TD]
[TD][/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]5[/TD]
[TD][/TD]
[TD]6[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]6[/TD]
[TD][/TD]
[TD]7[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]7[/TD]
[TD][/TD]
[TD]8[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]8[/TD]
[TD][/TD]
[TD]9[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]9[/TD]
[TD][/TD]
[TD]10[/TD]
[TD]11[/TD]
[/TR]
</tbody>[/TABLE]
I assume I will need another look-up table but I am not sure what format this would need to take or which DAX formulas are required to return the correct data.
Any help appreciated!
I am working on a forecast accuracy report that runs weekly - I have a custom dates table ('SCMWEEK') that contains weeks with WEEK_IK being the Key.
[TABLE="width: 254"]
<tbody>[TR]
[TD]WEEK_IK[/TD]
[TD]WEEK[/TD]
[TD]YEAR[/TD]
[TD]YYYYWW[/TD]
[/TR]
[TR]
[TD]838[/TD]
[TD]4[/TD]
[TD]2015[/TD]
[TD]201504[/TD]
[/TR]
[TR]
[TD]839[/TD]
[TD]5[/TD]
[TD]2015[/TD]
[TD]201505[/TD]
[/TR]
[TR]
[TD]840[/TD]
[TD]6[/TD]
[TD]2015[/TD]
[TD]201506[/TD]
[/TR]
[TR]
[TD]841[/TD]
[TD]7[/TD]
[TD]2015[/TD]
[TD]201507[/TD]
[/TR]
[TR]
[TD]842[/TD]
[TD]8[/TD]
[TD]2015[/TD]
[TD]201508[/TD]
[/TR]
</tbody>[/TABLE]
This table is linked to my data table via the YYYWW column and I have created calculations for LW using the GFITW and all is working:
Accuracy Wk-1:=IF(HASONEVALUE(SCMWEEK[WEEK_IK]),CALCULATE([Accuracy],
ALL('SCMWEEK'),FILTER(ALL('SCMWEEK'),SCMWEEK[WEEK_IK]=VALUES(SCMWEEK[WEEK_IK])-1)),BLANK())
However, when I want to compare TY vs. LY I am running into problems due to the variable length of timeframes used, meaning I cannot just amend the -1 in the above formula to -52.
The model used means that when comparing with LY an extra week may need to be added or a week removed to keep the Yr on Yr comparisons aligned:
[TABLE="width: 335"]
<tbody>[TR]
[TD="colspan: 2"]Duplicate week[/TD]
[TD][/TD]
[TD="colspan: 2"]Week Removed[/TD]
[/TR]
[TR]
[TD]TY Week[/TD]
[TD]LY Week[/TD]
[TD][/TD]
[TD]TY Week[/TD]
[TD]LY Week[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD][/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]3[/TD]
[TD][/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD][/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]5[/TD]
[TD][/TD]
[TD]6[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]6[/TD]
[TD][/TD]
[TD]7[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]7[/TD]
[TD][/TD]
[TD]8[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]8[/TD]
[TD][/TD]
[TD]9[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]9[/TD]
[TD][/TD]
[TD]10[/TD]
[TD]11[/TD]
[/TR]
</tbody>[/TABLE]
I assume I will need another look-up table but I am not sure what format this would need to take or which DAX formulas are required to return the correct data.
Any help appreciated!