'How to get all months as a date from a start & end date in DAX
im working on a calculated column in a SSAS model. My Idea is to generate every month as date ( f.e 2021-01-01) based on a start and end date, who are also columns of that entry. Basically i wanna duplicate every entries with the month column for further calculations
when i have startdate 2021-04-28 and enddate 2022-02-28 i want to have 2021-04-01 , 2021-05-01 etc... till 2022-02-01
how do i write this in DAX?
Solution 1:[1]
Try this way:
Calendar =
VAR start_date = DATE( 2021, 4, 28 )
VAR end_date = DATE( 2022, 2, 28 )
VAR start_date_first = DATE( YEAR( start_date ), MONTH( start_date ), 1 )
VAR end_date_eom = EOMONTH( end_date, 0 )
VAR result =
FILTER(
CALENDAR( start_date_first, end_date_eom ),
DAY( [Date] ) = 1
)
RETURN
result
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | intruderr |
