Forum Discussion

kyinghfedex's avatar
kyinghfedex
Regular Visitor
2 years ago
Solved

Table Return Values Based on 2 Criteria(dates)

Im trying to create a dynamic table, that returns a value based on the slicer selection. In a scenario, I want to show what were the projected sales number from previous 4 weeks, to see the change in...
  • Bmejia's avatar
    2 years ago

    Create a switch measure as below, 

    Days =

    SWITCH(TRUE(),
    (SELECTEDVALUE(WeekData[Sales Week]))=(SELECTEDVALUE(WeekData[Input Week])),"Current Week",
    (SELECTEDVALUE(WeekData[Sales Week])-7)=(SELECTEDVALUE(WeekData[Input Week])),"D-7",
    (SELECTEDVALUE(WeekData[Sales Week])-14)=(SELECTEDVALUE(WeekData[Input Week])),"D-14",
    (SELECTEDVALUE(WeekData[Sales Week])-21)=(SELECTEDVALUE(WeekData[Input Week])),"D-21",
    (SELECTEDVALUE(WeekData[Sales Week])-28)=(SELECTEDVALUE(WeekData[Input Week])),"D-28",0)
     
    Add your fields to the matrix table included the Days measure,  Then use the filter pane and filter days on  "is Not 0" so only shows 5 weeks worth of data from the Sales Week day selected.  if Days column is not sort correctly use the input weekly to sort the data.