Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Goodday,
I have a table with 2 dimensions and 2 measures that use the same dimension.
I would like to make a line chart from this, with showing all lines. But i seem to be unable to add both measures in the line chart. Why is this and how can i fix this?
Solved! Go to Solution.
Hi @Rollow
Based on your table, you want to create a line chart showing both Measure 1 and Measure 2 across different dimensions over two years. The issue you're experiencing is likely due to how your data is structured and how your visualization tool handles multiple measures.
Most visualization tools expect data in a "tidy" format where:
Each variable forms a column
Each observation forms a row
Each type of observational unit forms a table
Your current table has measures spread across columns, which can make it difficult to plot both measures simultaneously.
Go to "Transform Data" in Power BI
Select your table
Choose both Measure 1 and Measure 2 columns (hold Ctrl)
Click "Unpivot Columns" under the Transform tab
Rename the new columns:
"Attribute" → "Measure_Type"
"Value" → "Measure_Value"
Year Dimension Measure_Type Value 2023-2024 DH Measure 1 2.6 2023-2024 DH Measure 2 2.86 2023-2024 GEM Measure 1 2.5 2023-2024 GEM Measure 2 2.85 ... (and so on for all rows)
In this format, you can:
Put Year on the X-axis
Put Value on the Y-axis
Use Dimension for color encoding (lines)
Use Measure_Type to create separate lines for each measure
Select the Line Chart visualization
Configure fields:
X-axis: Year
Y-axis: Measure_Value
Legend: Measure_Type (to show both measures)
Details: Dimension (to separate lines by DH, GEM, etc.)
If you prefer not to transform data:
Select the "Line and Column Chart" visualization
Configure:
Shared X-axis: Year
Column Y-axis: Measure 1
Line Y-axis: Measure 2
Legend: Dimension
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! Thank you.
Hi @Rollow
Based on your table, you want to create a line chart showing both Measure 1 and Measure 2 across different dimensions over two years. The issue you're experiencing is likely due to how your data is structured and how your visualization tool handles multiple measures.
Most visualization tools expect data in a "tidy" format where:
Each variable forms a column
Each observation forms a row
Each type of observational unit forms a table
Your current table has measures spread across columns, which can make it difficult to plot both measures simultaneously.
Go to "Transform Data" in Power BI
Select your table
Choose both Measure 1 and Measure 2 columns (hold Ctrl)
Click "Unpivot Columns" under the Transform tab
Rename the new columns:
"Attribute" → "Measure_Type"
"Value" → "Measure_Value"
Year Dimension Measure_Type Value 2023-2024 DH Measure 1 2.6 2023-2024 DH Measure 2 2.86 2023-2024 GEM Measure 1 2.5 2023-2024 GEM Measure 2 2.85 ... (and so on for all rows)
In this format, you can:
Put Year on the X-axis
Put Value on the Y-axis
Use Dimension for color encoding (lines)
Use Measure_Type to create separate lines for each measure
Select the Line Chart visualization
Configure fields:
X-axis: Year
Y-axis: Measure_Value
Legend: Measure_Type (to show both measures)
Details: Dimension (to separate lines by DH, GEM, etc.)
If you prefer not to transform data:
Select the "Line and Column Chart" visualization
Configure:
Shared X-axis: Year
Column Y-axis: Measure 1
Line Y-axis: Measure 2
Legend: Dimension
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! Thank you.
User | Count |
---|---|
84 | |
76 | |
74 | |
48 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |