Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Replacement for Union in Direct Query

Hello everyone,   If I have this kind of table: It is confirmed, all rows will have same value on each columns.   Initially I want to Transpose this data To be come simply like this : ...
  • v-yalanwu-msft's avatar
    5 years ago

    Hi Anonymous  , 

     

    According to the official document , Calculated tables aren't supported:

    So,  you could create the A, B, C three columns  as three measures, and then use β€œunion() β€œto achieve , as follows:

    First: create three measures

    Ameasure = MAX('Table'[A])
    BMeasure = MAX('Table'[B])
    Cmeasure = MAX('Table'[C])

    Then create new table:

    newTable =
    DISTINCT (
        UNION (
            SELECTCOLUMNS ( 'Table', "Type", "A", "Description", [Ameasure] ),
            SELECTCOLUMNS ( 'Table', "Type", "B", "Description", [BMeasure] ),
            SELECTCOLUMNS ( 'Table', "Type", "C", "Description", [Cmeasure] )
        )
    )
    

    The final output is shown below:

     

    Last, If we create a virtual table with union(), the storage mode will change to mixed mode.

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.  

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    5 years ago

    Hi, Anonymous 

     

    You could see my pbix file. Your data source is still in DQ mode. Since you created a virtual table with union(), it is mix(), which does not affect your data source itself.

     

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.