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.
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 :
With an addition of 1 column, so probably like this :
The ABC in column [Field] is actually can be the column name of 1st table, I just want to make it easier.
Is this possible with Direct Query Mode ?
At first I thought a UNION like this :
UNION(
SELECTCOLUMNS('Table', "Type", "A", "Description", 'Table'[Column1]),
SELECTCOLUMNS('Table', "Type", "B", "Description", 'Table'[Column2]),
SELECTCOLUMNS('Table', "Type", "C", "Description", 'Table'[Column3]),
But it turns out, this UNION forced me to switch to Import Mode. Any replacement trick to make this possible in Direct Query ?
Thanks
Solved! Go to Solution.
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.
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.
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.
Hi,
Thanks, but unfortunately I must use pure DIrect Query.
rgds,
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.
@Anonymous , As far as I understood this transformation is only possible in import mode
So, no TRANSPOSE.. and also no UNION...
No other tricks ? 😅
@Anonymous , I was think of usin userealtionship with a table having distinct names (that can be as import mode table if needed)
But that depend of requirements https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi
In this manner we can take total from three columns
also run time union in a measure, depend on need
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 |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |