Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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

 

namewknovolumethiswkvolumelastweek
a1300
a22030
a34020
  • 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

  • dax's avatar
    dax
    6 years ago

    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 Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

13 Replies

  • 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's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Maybe:

     

    volumelastweek = CALCULATE([volumnethisweek],MAX([wkno])-1)

    • Anonymous's avatar
      Anonymous
      Not 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's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion
        Sorry:

        volumelastweek = CALCULATE([volumnethisweek],[wkno]=MAX([wkno])-1)