Skip to main content

Power BI

New

UNIONX

Vote (1) Share
Lutz Bendlin's profile image

Lutz Bendlin on 02 Oct 2021 17:39:11

I would like to be able to UNION a variable number of tables, including table variables that might be created as part of a measure or calculated table definition

Example: I want to capture all dates that are covered by a list of events

Table1:
Event Start End
A 10/2/2021 10/3/2021
B 9/30/2021 10/3/2021
C 10/5/2021 10/6/2021

Then assign a calendar to each event

Table2 = ADDCOLUMNS(Table1,"Calendar",CALENDAR([Start],[End]))

Event Start End Calendar
A 10/2/2021 10/3/2021 CALENDAR(10/2/2021,10/3/2021)
B 9/30/2021 10/3/2021 CALENDAR(9/30/2021,10/3/2021)
C 10/5/2021 10/6/2021 CALENDAR(10/5/2021,10/6/2021)

And finally be able to concatenate the resulting table variables

RESULT = UNIONX(Table2,[Calendar])

That would result in
10/2/2021
10/3/2021
9/30/2021
10/1/2021
10/2/2021
10/3/2021
10/5/2021
10/6/2021

and I can then take care of the duplicates as needed.