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
Mariollo
Helper I
Helper I

Problem with pivoting table

Hello everyone,

I have a table in Power BI that looks like this:

 

Week Start Users New Amount

01/01/20249,9941,459109,365
08/01/20249,5681,36290,593
15/01/202410,3921,54983,131
22/01/202410,0431,744175,936

 

I would like to transform it into this format, where each date is a column and the row labels are "Users," "New," and "Amount":

 

  01/01/2024 08/01/2024 15/01/2024 22/01/2024

Users9,9949,56810,39210,043
New1,4591,3621,5491,744
Amount109,36590,59383,131175,936

 

Does anyone know the best way to pivot the data like this in Power BI? Any advice on DAX formulas or transformations in Power Query would be greatly appreciated!

 

When I am trying to use simple matrix table I am missing headers and can't specify order of my metrics

 

1 ACCEPTED SOLUTION
Mariollo
Helper I
Helper I

Guys, forget my question.
Enabling this option solved all my issues for now:

Mariollo_0-1731495295233.png

 

View solution in original post

4 REPLIES 4
Mariollo
Helper I
Helper I

Guys, forget my question.
Enabling this option solved all my issues for now:

Mariollo_0-1731495295233.png

 

Mariollo
Helper I
Helper I

@v-zhouwen-msft @Greg_Deckler 


The problem is that right now this file is created manually in Excel using copy/paste.

The weeks are in columns, and the attributes are in rows. I need to replicate this format in Power BI in the same type of table.

Mariollo_1-1731491441238.png

 

The data from the database, of course, is in the format shown in the screenshot below.
Mariollo_0-1731491425576.png

 

The solution you provided is theoretically fine, but I do not have control over format in attributes, for example can't format some values into percentages %.

 

And since you mentioned that this approach might not be ideal, do you perhaps have another solution?

 
 

 

 

v-zhouwen-msft
Community Support
Community Support

Hi @Mariollo ,

Agree with Greg_Deckler 's answer, you just need to delete the "Promoted headers" step and then click "Transpose".

vzhouwenmsft_0-1731464550236.png

vzhouwenmsft_1-1731464605228.png

vzhouwenmsft_2-1731464629383.png

 

Best Regards,
Wenbin Zhou

Greg_Deckler
Super User
Super User

@Mariollo That's a transpose, not a pivot. You can do the following although that is generally not the form that you want for data analysis in Power BI.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vcy/CgIxDAbwV5HMAfOn6TWjL+Ai4lA6OHQSFe5O7vVt6+JByEc+fiRnuNX6OFzW+7wCwnWp89LyXLe2T8/357VCwQzExzZCElrv6N6TMZj3JEeN9oNpBy2mATVKvwnNdTi2P8eE6jKghf4xKbLygCJ7SEEHnMIoJkPXCKV8AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
    #"Transposed Table" = Table.Transpose(Source),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Week Start", type text}, {"01/01/2024", Int64.Type}, {"08/01/2024", Int64.Type}, {"15/01/2024", Int64.Type}, {"22/01/2024", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Week Start", "Type"}})
in
    #"Renamed Columns"

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

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.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.