Forum Discussion
NourJ
Helper III
3 years agoSpecific Calendar conditions by DAX
I would like to generate a calendar table using DAX that is based on another column in my table. My current table does not contain a date or month column, but it does have a "Round" column that sta...
- 3 years ago
Here's an example that shows one way to do it.
DatesRound = VAR startdate = DATE ( 2022, 5, 1 ) RETURN ADDCOLUMNS ( CALENDAR ( startdate, DATE ( 2023, 4, 30 ) ), "Round", 42 + ROUNDDOWN ( DATEDIFF ( startdate, [Date], MONTH ) / 2, 0 ) )Pat
ppm1
Solution Sage
3 years agoHere's an example that shows one way to do it.
DatesRound =
VAR startdate =
DATE ( 2022, 5, 1 )
RETURN
ADDCOLUMNS (
CALENDAR ( startdate, DATE ( 2023, 4, 30 ) ),
"Round",
42
+ ROUNDDOWN ( DATEDIFF ( startdate, [Date], MONTH ) / 2, 0 )
)
Pat