Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

SHOW 10 DAYS BACK TO SELECTEDVALUE

hi, i tried with a column with this sintax   column = if( table[date] >= max(table[date]) -10 , sales)   with this column i can show static data, i need to replace the max(table[date]) to selecte...
  • v-kelly-msft's avatar
    v-kelly-msft
    6 years ago

    Hi  Anonymous ,

     

    I created a sample table as below:

    First create a slicer table using below dax expression:

     

     

    Slicer = CALENDAR(MIN('Table'[Date]),MAX('Table'[Date]))

     

     

    Then create a measure as below:

     

     

    Measure = IF(SELECTEDVALUE('Slicer'[Date])=BLANK(),SUM('Table'[Sales]),IF(MAX('Table'[Date])>=SELECTEDVALUE('Slicer'[Date])-10&&MAX('Table'[Date])<=SELECTEDVALUE('Slicer'[Date]),SUM('Table'[Sales]),BLANK()))

     

     

    Finally you will see:(If no date is selected)

    if one date is selected:

     

     

     

    For the related .pbix file,pls click here.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!