Forum Discussion
Transform pivot table with two coluns
Hello,
I need a help,
I do a a pivot table like this:
And I need transform in something like this, include one more colunm
But using DAX expression, anybody help me?
Thanks a lot
Hi VRMENDESadq ,
I assume each of the columns you show is a measure on your model, what you need is to add a table with the following setup:
Category SortCategory Measure MeasureSorting Mes Atual 1 Meta Vol. 1 Mes Atual 1 Realizado 2 Mes Atual 1 % Ating. 3 Acumulado trimestre 2 Meta Pos. 4 Acumulado trimestre 2 Pos Acumulado 5 Acumulado trimestre 2 % Ating Pos. 6 Acumulado trimestre 2 Meta Vol. Acumulado 7 Acumulado trimestre 2 Real Vol. Acumulado 8 Acumulado trimestre 2 % Ating. 9 Now add the following measure:
Value Total = SWITCH(SELECTEDVALUE(Table[MeasureSort]), 1, [Meta Vol.], 2, [Realizado], 3, [% Ating.], 4, [Meta Pos.], 5, [Pos Acumulado], 6, [% Ating Pos], 7, [Meta Vol. Acumulado], 8, [Real Vol. Acumulado], 9, [% Ating.])Now use the Category and the Measure of the previous table in the columns of the matrix and the measure on the values, should give expected result.
2 Replies
- MFelixSuper User
Hi VRMENDESadq ,
I assume each of the columns you show is a measure on your model, what you need is to add a table with the following setup:
Category SortCategory Measure MeasureSorting Mes Atual 1 Meta Vol. 1 Mes Atual 1 Realizado 2 Mes Atual 1 % Ating. 3 Acumulado trimestre 2 Meta Pos. 4 Acumulado trimestre 2 Pos Acumulado 5 Acumulado trimestre 2 % Ating Pos. 6 Acumulado trimestre 2 Meta Vol. Acumulado 7 Acumulado trimestre 2 Real Vol. Acumulado 8 Acumulado trimestre 2 % Ating. 9 Now add the following measure:
Value Total = SWITCH(SELECTEDVALUE(Table[MeasureSort]), 1, [Meta Vol.], 2, [Realizado], 3, [% Ating.], 4, [Meta Pos.], 5, [Pos Acumulado], 6, [% Ating Pos], 7, [Meta Vol. Acumulado], 8, [Real Vol. Acumulado], 9, [% Ating.])Now use the Category and the Measure of the previous table in the columns of the matrix and the measure on the values, should give expected result.
- mickey64Super User
For your reference.
Step 0: I use these date below.
Step 1: I unvibot 'DATA' table on Power Query Editor.
<Before>
<After>
Step 2: I add a relationship below.
Step 3: I make a 'Matrix' below.