Forum Discussion

Junaid11's avatar
Junaid11
Icon for Helper V rankHelper V
3 years ago
Solved

WOW Week over week change based on multiple slicer selection not working

Hello,
I have below data. I want to do Week over week % change and using below formulas: I have creted the mesuare with date table as well as single table but when I use slicer of Event or type it does not filter. If I make multiple selection in the slicer then it doesn ot work even. 

VisitsRevenueDateEventType
                45$345Nov 3, 2022 HolidaySocial
                34$6Nov 10, 2022 Black FridayWeb
                   7$56Nov 10, 2022 HolidayWeb
                   5$567Nov 17, 2022 Black FridaySocial
                   5$34Nov 17, 2022 HolidayWeb
                23$4,757Nov 24, 2022 Black FridaySocial
              456$457Nov 24, 2022 Cyber WeekWeb
                45$34Nov 24, 2022 HolidaySocial
                76$567Dec 1, 2022 Warehouse BlowoutSocial
              768$7Dec 1, 2022 HolidaySocial
                45$456Dec 8, 2022 HolidayWeb
                90$567Dec 15, 2022 HolidaySocial
                54$45Dec 22, 2022 Boxing WeekWeb
                   4$23Dec 22, 2022 HolidayWeb

new Created columns are:
Week Start date = 'Table'[Date]+-1*WEEKDAY('Table'[Date],2)+1
Week End date = 'v'[Date]+ 7-1*WEEKDAY('Table'[Date],2)
Week Rank = RANKX(all('Date'),'Table'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX(all('Date'),'Table'[Year Week],,ASC,Dense) //YYYYWW format

 

measures
This Week = CALCULATE(sum('Table'[Visits]), FILTER(ALL('Table'),'Table'[Week Rank]=max('Table'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Visits]), FILTER(ALL('Table'),'Table'[Week Rank]=max('Table'[Week Rank])-1))
WOW = (This Week-Last Week)/Last Week

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Junaid11 

    You can create a new column in table:

    Weeknum = WEEKNUM('Table'[Date],2)

    then create a measure

    Measure = var _thisweek=SUMX(FILTER(ALLSELECTED('Table'),[Weeknum]=MAX([Weeknum])),[Visits])
    var _lastweek=SUMX(FILTER(ALLSELECTED('Table'),[Weeknum]=MAX([Weeknum])-1),[Visits])
    return DIVIDE(_thisweek-_lastweek,_lastweek)

     

    Best Regards!

    Yolo Zhu

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

3 Replies

  • Hi,

    You should create a Calendar Table with calculated column formulas for Year, Month number, Month name and week number.  Sort the Month name column by the Month number column.  Create a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table.  To your visual, drag Year and week number from the Calendar Table.  Write these measures

    V = sum('Table'[Visits])

    V last week = calculate([V],datesbetween(calendar[date],min(calendar[date])-7,max(calendar[date])-7))

    WoW = divide(([V]-[V last week]),[V last week])

    Hope this helps.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Junaid11 

    You can create a new column in table:

    Weeknum = WEEKNUM('Table'[Date],2)

    then create a measure

    Measure = var _thisweek=SUMX(FILTER(ALLSELECTED('Table'),[Weeknum]=MAX([Weeknum])),[Visits])
    var _lastweek=SUMX(FILTER(ALLSELECTED('Table'),[Weeknum]=MAX([Weeknum])-1),[Visits])
    return DIVIDE(_thisweek-_lastweek,_lastweek)

     

    Best Regards!

    Yolo Zhu

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

    • Xavius's avatar
      Xavius
      Frequent Visitor

      I have same issue that slicer is not showing the results of my  WOW% measure  in a table 

       

      Below is my measures that doesn't work.  

      SalesLastWeek = 

      calculate ( 

      sum( table[sales]), 

      filter( 

      all( table[week]), 

      table[week]=max(table[week])-1)) 

       

      WOW% = divide (sales this week - sales lastweek, sales lastweek) 

       

      please help me on this