Forum Discussion
Anonymous
6 years agoNot applicable
Pivot data in dax
Hello Everybody,
I've no access to the query editor (so DAX) and I got the following table1
| Type | Phase1 | Phase2 | Phase3 |
| Type1 | 12 | ||
| Type2 | 10 | ||
| Type3 | 8 | 14 |
I want the following table2 (pivot on colums Phase1/2/3 and sum on Data by grouping on type).
| Phases | Data |
| Phase1 | 12 |
| Phase2 | 18 |
| Phase3 | 14 |
Fo the moment, I get :
| Phases | Data |
| Phase1 | 12 |
| Phase2 | 10 |
| Phase2 | 8 |
| Phase3 | 14 |
with the following code:
Table2 =
FILTER(
UNION(
SELECTCOLUMNS(Table1;"Phases";"Phase1";"Data";Table1[Phase1]);
SELECTCOLUMNS(Table1;"Phases";"Phase2";"Data";Table1[Phase2]);
SELECTCOLUMNS(Table1;"Phases";"Phase3";"Data";Table1[Phase3])
);[Data]<>blank()
)
But I don't see how to get only one line for phase2.
If someone has an idea, please share !
Regards,
CR
Anonymous instead of selectcolumns use summarize
SUMMARIZE( FILTER ( Table, Table[Phase2] <> BLANK()),"Phases", "Phase2", "Data", SUM ( Table[Phase2)))do it for every phase.
2 Replies
- parry2kSuper User
Anonymous instead of selectcolumns use summarize
SUMMARIZE( FILTER ( Table, Table[Phase2] <> BLANK()),"Phases", "Phase2", "Data", SUM ( Table[Phase2)))do it for every phase.
- AnonymousNot applicable
thanks parry2k
it works fine !
Table2 = UNION( SUMMARIZE(Table1;"Phase";"Phase1";"Data";SUM(Table1[Phase1])); SUMMARIZE(Table1;"Phase";"Phase2";"Data";SUM(Table1[Phase2])); SUMMARIZE(Table1;"Phase";"Phase3";"Data";SUM(Table1[Phase3])) )