Forum Discussion
Data Reshaping ( multiple assignment to single assignment)
- 5 years ago
Hi, Anonymous
You can create a Calculated column and a Measure to get the tables you want.
Calculated column :
Name_Field =
VAR t1 =
SELECTCOLUMNS ( 'Table', "Name", 'Table'[Name], "Field", 'Table'[Field1] )
VAR t2 =
SELECTCOLUMNS ( 'Table', "Name", 'Table'[Name], "Field", 'Table'[Field2] )
VAR t3 =
SELECTCOLUMNS ( 'Table', "Name", 'Table'[Name], "Field", 'Table'[Field3] )
VAR t4 =
SELECTCOLUMNS ( 'Table', "Name", 'Table'[Name], "Field", 'Table'[Field4] )
VAR t5 =
SELECTCOLUMNS ( 'Table', "Name", 'Table'[Name], "Field", 'Table'[Field5] )
VAR union_t =
UNION ( t1, t2, t3, t4, t5 )
VAR tt =
FILTER ( union_t, AND ( [Field] <> "", NOT ( ISBLANK ( [Field] ) ) ) )
RETURN
tt
Measure :
Count = COUNTX('Name_Field','Name_Field'[Field])
The result looks like this:
Here is the pbix file.
Best Regards,
Caiyun Zheng
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous , Try to unpivot the table in power query
https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose : https://yodalearning.com/tutorials/power-query-helps-transposing-data/
Hello amitchandak
Thank you for your reply. The data is not pivoted from the beginning on, the base table is just a flat data structure. Do you know how I can work with your solution then?