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.
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.