cancel
Showing results for
Did you mean:

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Helper III

## Problem with union (selectcolumns

Tablemeasure = Union(
selectcolumns(Table A,"Opening_Date", Table A[Opening_Date]),
)

I created a measure using this format above but when I try to put it into a visual I get the error below. Anyone have an idea of what I might be doing wrong?

1 ACCEPTED SOLUTION
Resident Rockstar

If you need a list of dates for a visual, create a calculated table instead of a measure :

CombinedDatesTable = UNION(
SELECTCOLUMNS(TableA, "Date", TableA[Opening_Date]),
)

then for the measure :

UniqueDateCount = DISTINCTCOUNT(UNION(SELECTCOLUMNS(TableA, "Date", TableA[Opening_Date]), SELECTCOLUMNS(TableB, "Date", TableB[Business_Date])))

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
4 REPLIES 4
Resident Rockstar

If you need a list of dates for a visual, create a calculated table instead of a measure :

CombinedDatesTable = UNION(
SELECTCOLUMNS(TableA, "Date", TableA[Opening_Date]),
)

then for the measure :

UniqueDateCount = DISTINCTCOUNT(UNION(SELECTCOLUMNS(TableA, "Date", TableA[Opening_Date]), SELECTCOLUMNS(TableB, "Date", TableB[Business_Date])))

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Helper III

This is what I created but I'm only getting the Material column in the resulting table?

TableUnion = union(selectcolumns('material class',"Material", [Material Class]),selectcolumns('merge1',"Quantity", [Quantity Received for Current Year]), selectcolumns('material_class' ,"Material", [MATERIAL CLASS]  ) ,  selectcolumns('RFID/Barcode Defective Material Submittals' ,"Quantity", [quantity]  ) )

Resident Rockstar

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Helper III

Your solution worked, I just had to tweek it a bit for my situation. I accepted your solution.