Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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 what numbers for next month look like. When they filter for Next Month in the 'Date Selection' filter, the 'Days left in Month' visual still only show the date diff between today and end of current month.
How can I set it up so that this visual will dynamically change? If they're looking at current month, it will take the date diff between today and end of month. And if they're looking at next month, it will just calculate total days in the month? I think a SWITCH() function will be used here, but not sure how to implement this.
Solved! Go to Solution.
@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,
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?
@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,
User | Count |
---|---|
98 | |
76 | |
75 | |
48 | |
27 |