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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
CR
Resolver II
Resolver II

Pivot data in dax

Hello Everybody,

 

I've no access to the query editor (so DAX) and I got the following table1

 

TypePhase1Phase2Phase3
Type112  
Type2 10 
Type3 814

 

I want the following table2 (pivot on colums Phase1/2/3 and sum on Data by grouping on type).

 

PhasesData
Phase112
Phase218
Phase314

 

Fo the moment, I get :

 

PhasesData
Phase112
Phase210
Phase28
Phase314

 

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

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@CR instead of selectcolumns use summarize

 

SUMMARIZE( FILTER ( Table, Table[Phase2] <> BLANK()),"Phases", "Phase2", "Data", SUM ( Table[Phase2)))

 

do it for every phase.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@CR instead of selectcolumns use summarize

 

SUMMARIZE( FILTER ( Table, Table[Phase2] <> BLANK()),"Phases", "Phase2", "Data", SUM ( Table[Phase2)))

 

do it for every phase.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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]))
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.