Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
VRMENDESadq
Frequent Visitor

Transform pivot table with two coluns

Hello, 

 

I need a help, 

 

I do a a pivot table like this:

VRMENDESadq_0-1761660324093.png

And I need transform in something like this, include one more colunm

VRMENDESadq_1-1761660357034.png

But using DAX expression, anybody help me? 

Thanks a lot



1 ACCEPTED SOLUTION
MFelix
Super User
Super 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.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
mickey64
Super User
Super User

For your reference.

 

Step 0: I use these date below.

mickey64_0-1761665962056.png

mickey64_1-1761665998389.png

 

Step 1: I unvibot 'DATA' table on Power Query Editor.

<Before>

mickey64_2-1761666083474.png

 

<After>

mickey64_3-1761666111980.png

 

Step 2: I add a relationship below.

mickey64_4-1761666181895.png

 

Step 3: I make a 'Matrix' below.

mickey64_5-1761666256003.png

MFelix
Super User
Super 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.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors