Forum Discussion
Line chart points from columns
- 4 years ago
Here is one possible approach
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci4tKks1MDBU0lEyNAATINIUxozVgSsxAgoZgcSNQYQJiLAAKogFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Curve = _t, ValueA = _t, MeasureA = _t, ValueB = _t, MeasureB = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Curve", type text}, {"ValueA", Int64.Type}, {"MeasureA", Int64.Type}, {"ValueB", Int64.Type}, {"MeasureB", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "List", each {{[ValueA],[MeasureA]},{[ValueB],[MeasureB]}}), #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Curve", "List"}), #"Expanded List" = Table.ExpandListColumn(#"Removed Other Columns", "List"), #"Extracted Values" = Table.TransformColumns(#"Expanded List", {"List", each Text.Combine(List.Transform(_, Text.From), "#(tab)"), type text}), #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "List", Splitter.SplitTextByDelimiter("#(tab)", QuoteStyle.Csv), {"x", "y"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"x", Int64.Type}, {"y", Int64.Type}}) in #"Changed Type1" - Anonymous4 years ago
Hi crizbe ,
I think you can create a relationship between Plan table and Curve table by [Curve] column.
For reference: Create and manage relationships in Power BI Desktop
Then you can create a slicer by [Plan] column from Plan table.
By default:
Select Plan001:
Select Plan002:
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes, usually you would need to unpivot your Curves table - in this case in pairs.
What's the importance of "A" and "B" - does that play any role later?
Thanks, yes A and B are the X and Y Values of each point in the chart
- lbendlin4 years agoSuper User
Here is one possible approach
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci4tKks1MDBU0lEyNAATINIUxozVgSsxAgoZgcSNQYQJiLAAKogFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Curve = _t, ValueA = _t, MeasureA = _t, ValueB = _t, MeasureB = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Curve", type text}, {"ValueA", Int64.Type}, {"MeasureA", Int64.Type}, {"ValueB", Int64.Type}, {"MeasureB", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "List", each {{[ValueA],[MeasureA]},{[ValueB],[MeasureB]}}), #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Curve", "List"}), #"Expanded List" = Table.ExpandListColumn(#"Removed Other Columns", "List"), #"Extracted Values" = Table.TransformColumns(#"Expanded List", {"List", each Text.Combine(List.Transform(_, Text.From), "#(tab)"), type text}), #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "List", Splitter.SplitTextByDelimiter("#(tab)", QuoteStyle.Csv), {"x", "y"}), #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"x", Int64.Type}, {"y", Int64.Type}}) in #"Changed Type1"- crizbe4 years agoNew Member
Thank you very much. It worked like a charm! I have one slight issue now. How am I able to filter the values now based on selectedValues?
- Anonymous4 years agoNot applicable
Hi crizbe ,
I think you can create a relationship between Plan table and Curve table by [Curve] column.
For reference: Create and manage relationships in Power BI Desktop
Then you can create a slicer by [Plan] column from Plan table.
By default:
Select Plan001:
Select Plan002:
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Hi crizbe ,
I agree with lbendlin's reply. Due to we cannot see calculated column or measure created by Dax in Power Query Editor, firstly, you need to calcualte MeasureA and MeasureB by M code in Power Query Editor. Then you can follow lbendlin's step to unpivot your table.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.