Forum Discussion

murphm6's avatar
murphm6
Helper II
3 years ago
Solved

Dynamically change card visual based on date selection

Hey all,   I have a card visual which displays the 'Days Left in Month'. This is a measure that just takes the date difference between today and EOMONTH.    My end-user wants to be able to see wh...
  • rsbin's avatar
    rsbin
    3 years ago

    murphm6 ,

    You are close.   Please try this:

    DaysLeftinMonth = SWITCH(
                          TRUE(),
                          [MaxSelectedDate] = EOMONTH( TODAY(), 0 ), DATEDIFF( TODAY(), (EOMONTH( TODAY(), 0 )), DAY ),
                          DAY(EOMONTH(TODAY(), 1) ))
    
    Where
    MaxSelectedDate = MAX(DIM_Date[Date] )

    My quick test shows it works, but may need tweaking depending on how many Months in the future the user selects.

    Hope you can get this to work for you.

    Regards,