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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Nozama
Helper I
Helper I

Pivot/Unpivot or Transpose Solution to plot line chart

I have the following structure in a table:

NameMetricJuly 2025August 2025Sept 2025Oct 2025Nov 2025Dec 2025Jan 2026

Alpha

Volume0.853040.1459320.5588140.2607460.9274120.9385760.941928
AlphaSurface0.6395940.8452050.5061640.7894470.5120910.1807070.294231

Alpha

Length0.3641180.6548810.2323210.1642250.4341640.5320530.047781

Gamma

Length

0.4637190.5250740.7198420.5317540.8508020.857330.457149

Gamma

Surface0.1022470.5430210.8289110.1489180.4519050.7785380.565927
GammaVolume0.7553310.3970140.3719910.9751350.9056380.9578970.256631
EpsilonLength0.7974440.0798870.163390.4171410.854730.5838540.374728
EpsilonSurface0.2592660.0215440.3671670.1611250.1023620.6757980.317543
EpsilonVolume0.5637340.3480620.7226320.7648140.5266060.2615070.138122
BetaVolume0.0985890.4123910.6372960.7921910.2608990.5100290.925143
BetaSurface0.2071630.146520.4383470.7167660.9480660.0490090.401906
BetaLength0.8370540.939430.0578440.2428150.4734920.5366310.447548

I want to be able to plot line charts for series "Volume", "Surface", "Length" over the time axis (X) as column headers. The slicer is the Name column.

For the life of me, I have tried pivoting, unpivoting, transposing and what not, and can't figure out how to get the table into a proper format for plotting this. Please help. Thanks!

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Nozama,

 

Try this solution.

 

1. In Power Query, select all Month Year columns and unpivot.

 

DataInsights_0-1752705174880.png

 

Rename columns as desired.

 

DataInsights_1-1752705234770.png

 

2. Create measure:

 

Metric Value = SUM ( 'Table'[Value] )

 

3. Create visuals:

 

DataInsights_2-1752705311633.png

 





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This M code transforms your data as follows

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name", "Metric"}, "Attribute", "Value"),
    #"Pivoted Column" = Table.Pivot(#"Unpivoted Other Columns", List.Distinct(#"Unpivoted Other Columns"[Metric]), "Metric", "Value"),
    #"Changed Type" = Table.TransformColumnTypes(#"Pivoted Column",{{"Name", type text}, {"Attribute", type date}, {"Volume", type number}, {"Surface", type number}, {"Length", type number}})
in
    #"Changed Type"

Hope this helps.

Ashish_Mathur_0-1752722539499.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
DataInsights
Super User
Super User

@Nozama,

 

Try this solution.

 

1. In Power Query, select all Month Year columns and unpivot.

 

DataInsights_0-1752705174880.png

 

Rename columns as desired.

 

DataInsights_1-1752705234770.png

 

2. Create measure:

 

Metric Value = SUM ( 'Table'[Value] )

 

3. Create visuals:

 

DataInsights_2-1752705311633.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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