Forum Discussion
wk vs last wk comparing
hi all
i have data as below
name: is column
wkno is column
volumethiswk is measure (working well)
now, i wanna make another measure for volumelastweek then can show data for last week then I can create a new measure for difference number week vs week.
pls give me a hand
| name | wkno | volumethiswk | volumelastweek |
| a | 1 | 30 | 0 |
| a | 2 | 20 | 30 |
| a | 3 | 40 | 20 |
Anonymous
Check my file how I used Week Rank/Week number to get current vs prior week
https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0
Better you move week to separate table.
This week Sales = CALCULATE(SUM(Sales[Net Sales]),FILTER(all('Week'),'Week'[Week]=max('Week'[Week]))) last week Sales = CALCULATE(SUM(Sales[Net Sales]),FILTER(all('Week'),'Week'[Week]=max('Week'[Week])-1))Prefer the rank solution. As that will work Multi Year
Hi Anonymous ,
You could try measure like below to re-define the grand total to see whether it work or not.
Measure 2 = IF(HASONEVALUE(T2[name]),[Measure],SUMX(T2,[Measure]))Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
13 Replies
- amitchandak
Super User
Anonymous
Check my file how I used Week Rank/Week number to get current vs prior week
https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0
Better you move week to separate table.
This week Sales = CALCULATE(SUM(Sales[Net Sales]),FILTER(all('Week'),'Week'[Week]=max('Week'[Week]))) last week Sales = CALCULATE(SUM(Sales[Net Sales]),FILTER(all('Week'),'Week'[Week]=max('Week'[Week])-1))Prefer the rank solution. As that will work Multi Year
- Greg_Deckler
Community Champion
Maybe:
volumelastweek = CALCULATE([volumnethisweek],MAX([wkno])-1)
- AnonymousNot applicable
i use your code but it show
A function 'MAX' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
but not use MAX for any others one
- Greg_Deckler
Community Champion
Sorry:
volumelastweek = CALCULATE([volumnethisweek],[wkno]=MAX([wkno])-1)