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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ClementA
Regular Visitor

Power query : Column header with Volume & Year

 

 

Hello Power BI community,

 

Beginner in Power BI and former user of Pivot table in excel, I am having a file with component yearly volume and vehicle yearly volume column (please see picture).  Power BI recognize volumes numbers but not the yearly date of component / vehicle.

ClementA_0-1597216151001.png

 

I would like to create a chart with X axis years, Y axis Volumes of vehicle and series for the car nameplates.

I would also need to have component volume Y axis on a second chart.

Below you can see Series & X axis are revert as date is not recognize by Power BI :

ClementA_2-1597216861827.png

 

In Excel I was usually switching date X& Y but here I imagine there is a smarter way to do it via Power query ?

Any pro tips to make this more smart and easy ?

 

Thanks a lot for reading and your precious help !

Clement

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @ClementA , 

You could refer to my sample for details

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIGYjMgNoJicygNkktUitWJhsuYArEJFJtCdYFUJYFVwURh5plBVVpCVSUrxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"C Volumn 2012" = _t, #"C Volumn 2013" = _t, #"C Volumn 2014" = _t, #"C Volumn 2015" = _t, #"R Volumn 2012" = _t, #"R Volumn 2013" = _t, #"R Volumn 2014" = _t, #"R Volumn 2015" = _t, name = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"name"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Attribute.1", "Attribute.2", "Attribute.3"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Attribute.2"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Attribute.1", "type"}, {"Attribute.3", "date"}})
in
    #"Renamed Columns"

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
dax
Community Support
Community Support

Hi @ClementA , 

You could refer to my sample for details

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTIGYjMgNoJicygNkktUitWJhsuYArEJFJtCdYFUJYFVwURh5plBVVpCVSUrxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"C Volumn 2012" = _t, #"C Volumn 2013" = _t, #"C Volumn 2014" = _t, #"C Volumn 2015" = _t, #"R Volumn 2012" = _t, #"R Volumn 2013" = _t, #"R Volumn 2014" = _t, #"R Volumn 2015" = _t, name = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"name"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Attribute.1", "Attribute.2", "Attribute.3"}),
    #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Attribute.2"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Attribute.1", "type"}, {"Attribute.3", "date"}})
in
    #"Renamed Columns"

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Zoe,

Awesome, looking at your example file, I managed to get the steps, unpivoting then fractioning

Thanks a lot works exactly how I was looking for...:) !

 

ClementA_0-1597411637713.png

 

amitchandak
Super User
Super User

@ClementA , you might to unpivot twice and split column to get year

https://kohera.be/blog/power-bi/how-to-unpivot-twice/

 

https://radacad.com/pivot-and-unpivot-with-power-bi

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

 

Unpivot only the yearly volume column to lines ? and then split the title ?

Tried unpivot vehicle & component volume once where I hand up with this :

ClementA_0-1597398351779.png

 

Should I then re unpivot it ?

Thank you,

Clément

Hi  @amitchandak  !

Thanks a lot for your proposal, I was trying single unpivot, let met work on it and confirm you 🙂 !

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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