Forum Discussion
Anonymous
7 years agoNot applicable
Previous Week Sales
Hi Having searched extensively I know this is a question that has come up lots but I just cannot manage to get prior week sales in the format I need. I'm trying to calculate week vs prior week p...
- 7 years ago
The problem you are having with your second measure is the ALL(sales_table). It is removing all filters (including store) that come into the calc. What you want is ALL(sales_table[week]).
The calc can be made more clear using a variable. Give this a try:
Prior Week Sales = VAR PriorWeek = SELECTEDVALUE ( Sales_Table[Week] ) -1 RETURN CALCULATE( SUM ( Sales_Table[Sales] ), ALL ( Sales_Table[Week] ), Sales_Table[Week] = PriorWeek )
jdbuchanan71
7 years agoSuper User
The problem you are having with your second measure is the ALL(sales_table). It is removing all filters (including store) that come into the calc. What you want is ALL(sales_table[week]).
The calc can be made more clear using a variable. Give this a try:
Prior Week Sales =
VAR PriorWeek = SELECTEDVALUE ( Sales_Table[Week] ) -1
RETURN
CALCULATE(
SUM ( Sales_Table[Sales] ),
ALL ( Sales_Table[Week] ),
Sales_Table[Week] = PriorWeek
)Anonymous
7 years agoNot applicable
That's immense - thank you very much!