Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi everyone !
I try to create a calendar table based on multiple columns to get the first date and the last date.
Table_1 contains the columns DATE_1, DATE_2 and DATE_3.
I find out to get the first date and the last date for one column:
CALENDAR_TABLE = CALENDAR(FIRSTDATE(TABLE_1[DATE_1]);LASTDATE(TABLE_1[DATE_1]))
But I need to refer to the 3 columns, not only the DATE_1 table !
If I understand, I need to:
Someone could help me on that ?
Regards,
CR
Solved! Go to Solution.
Hi @CR ,
why so complicated?
Calendar_auto = CALENDARAUTO()
Or try this...
CALENDAR_TABLE =
VAR DATE_TABLE =
UNION (
SELECTCOLUMNS ( Table_1, "Date", Table_1[DATE_1] ),
SELECTCOLUMNS ( Table_1, "Date", Table_1[DATE_2] ),
SELECTCOLUMNS ( Table_1, "Date", Table_1[DATE_3] )
)
RETURN
CALENDAR ( MINX ( DATE_TABLE, [Date] ), MAXX ( DATE_TABLE, [Date] ) )
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Hi @CR
look at this.
CALENDARAUTO()
https://docs.microsoft.com/en-us/dax/calendarauto-function-dax
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Hi @mwegener
Thanks for your quick answer. I also tried to generate a calendar with CALENDARAUTO function including a variable gathering my 3 columns coming from TABLE_1.
Calendar_auto =
GENERATE(
CALENDARAUTO();
VAR CurrentDay = UNION(
SELECTCOLUMNS('Table_1';"table 1";'Table_1'[DATE_1]);
SELECTCOLUMNS('Table_1';"table 2";'Table_1'[DATE_2]);
SELECTCOLUMNS('Table_1';"table 3";'Table_1'[DATE_3]))
RETURN
CurrentDay)
In some ways, it worked because it contains all the days of the years 2019 / 2020 / 2021 / 2022 / 2023.
But, all dates are duplicated several times (DD/MM/YYY):
01/01/2019 |
01/01/2019 |
01/01/2019 |
01/01/2019 |
01/01/2019 |
02/01/2019 |
02/01/2019 |
02/01/2019 |
02/01/2019 |
Do you see why ?
Regards,
CR
Hi @CR ,
why so complicated?
Calendar_auto = CALENDARAUTO()
Or try this...
CALENDAR_TABLE =
VAR DATE_TABLE =
UNION (
SELECTCOLUMNS ( Table_1, "Date", Table_1[DATE_1] ),
SELECTCOLUMNS ( Table_1, "Date", Table_1[DATE_2] ),
SELECTCOLUMNS ( Table_1, "Date", Table_1[DATE_3] )
)
RETURN
CALENDAR ( MINX ( DATE_TABLE, [Date] ), MAXX ( DATE_TABLE, [Date] ) )
Regards,
Marcus
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Thanks Marcus, this is indeed more simple and... really efficient !
CR
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |