Forum Discussion
Dynamic date difference
- 1 year ago
Hello Dodo96
DAX for calculated column
Date Range Category =
VAR SelectedMaxDate =
CALCULATE (
MAX ( 'Calendar'[Date] ),
ALLSELECTED ( 'Calendar' )
)
VAR DaysDiff =
DATEDIFF ( Table1[Date], SelectedMaxDate, DAY )
RETURN
SWITCH (
TRUE(),
DaysDiff <= 30, "Within 30 days",
DaysDiff <= 60, "31 to 60 days",
DaysDiff > 60, "Over 60 days",
BLANK()
)
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
Hello Dodo96
DAX for calculated column
Date Range Category =
VAR SelectedMaxDate =
CALCULATE (
MAX ( 'Calendar'[Date] ),
ALLSELECTED ( 'Calendar' )
)
VAR DaysDiff =
DATEDIFF ( Table1[Date], SelectedMaxDate, DAY )
RETURN
SWITCH (
TRUE(),
DaysDiff <= 30, "Within 30 days",
DaysDiff <= 60, "31 to 60 days",
DaysDiff > 60, "Over 60 days",
BLANK()
)
Thanks,
Pankaj Namekar | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.