Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Problem with union (selectcolumns

Tablemeasure = Union(
selectcolumns(Table A,"Opening_Date", Table A[Opening_Date]), 
selectcolumns(Table B,"Business_Date", Table B[Business_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?

 

  • 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]),
        SELECTCOLUMNS(TableB, "Date", TableB[Business_Date])
    )

    then for the measure : 

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

     

4 Replies

  • 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]),
        SELECTCOLUMNS(TableB, "Date", TableB[Business_Date])
    )

    then for the measure : 

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      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]  ) )