Forum Discussion
murphm6
3 years agoHelper II
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...
- 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,
murphm6
3 years agoHelper II
Switch(SELECTEDVALUE('Calendar'[Date]), MONTH(TODAY()), DATEDIFF(TODAY(), EOMONTH(TODAY(), 0), DAY), MONTH(TODAY()+1), Day(EOMONTH(TODAY() + 1,0)))
Tried using this, but doesn't seem to be working correctly. Anyone have any suggestions?
rsbin
3 years agoCommunity Champion
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,