Forum Discussion
mariajuliao
4 years agoFrequent Visitor
Transposing / Transforming data with DAX
I want to transform the data from this format: ID CaseNumber Asset1 Asset2 AA BB 1 2 CC DD 3 4 To this format: ID CaseNumber Asset Value AA BB Asset1 1 AA B...
- 4 years ago
It's a bit manual, but you can do it as I demonstrated here:
https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax
UNION ( SELECTCOLUMNS ( T, "ID", T[ID], "CaseNumber", T[CaseNumber], "Asset", "Asset1", "Value", T[Asset1] ), SELECTCOLUMNS ( T, "ID", T[ID], "CaseNumber", T[CaseNumber], "Asset", "Asset2", "Value", T[Asset2] ) )
AlexisOlson
4 years agoSuper User
It's a bit manual, but you can do it as I demonstrated here:
https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax
UNION (
SELECTCOLUMNS (
T,
"ID", T[ID],
"CaseNumber", T[CaseNumber],
"Asset", "Asset1",
"Value", T[Asset1]
),
SELECTCOLUMNS (
T,
"ID", T[ID],
"CaseNumber", T[CaseNumber],
"Asset", "Asset2",
"Value", T[Asset2]
)
)- mariajuliao4 years agoFrequent Visitor
This was very helpful!!
One other question -- Some of the values under the Asset1, Asset2 columns are blank. Is there any way that I can ommit those?
- AlexisOlson4 years agoSuper User
You can wrap a FILTER around the whole thing.
FILTER ( UNION ( [...] ), NOT ISBLANK ( [Asset] ) )