Forum Discussion
rpiboy_1
Helper V
2 years agoPrevious Period Pattern, inconsistent results
I have two fact tables joined to the same (well formed) date Table, both on 'Date'[Date]. In fact table 1 I'm using the following measure to calculate previous period for a sumed value: Prev...
- 2 years ago
rpiboy_1 Variables (VAR) despite their name are constants and once calculated remain the same value regardless of anything you might try to do. So, that's the reason for the results you are getting.
Anonymous
2 years agoNot applicable
Hi rpiboy_1 ,
I’d like to acknowledge the valuable input provided by Greg_Deckler . Their initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.
You can refer to my example and make appropriate changes to your measure.
Measure =
VAR _result =
SWITCH(
TRUE(),
ISINSCOPE( 'Date'[Date].[Day] ),
CALCULATE( SUM('financials'[ Sales]), DATEADD( 'Date'[Date], -1, DAY )),
ISINSCOPE( 'Date'[Date].[Month] ),
CALCULATE( SUM('financials'[ Sales]) , DATEADD( 'Date'[Date], -1, MONTH )),
ISINSCOPE( 'Date'[Date].[Quarter] ),
CALCULATE( SUM('financials'[ Sales]) , DATEADD( 'Date'[Date], -1, QUARTER )),
ISINSCOPE( 'Date'[Date].[Year]),
CALCULATE( SUM('financials'[ Sales]) , DATEADD( 'Date'[Date], -1, YEAR ))
)
RETURN
_result
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.