Forum Discussion
Multi-variable Scatter Plot
- 8 years ago
If I am understanding your table correctly, the numbers in each Compound Column represent the concentration that you want to display on the X axis, correct? If so, try the following steps:
1. Load the table into PowerBI and edit the query.
2. Select all of your Compound columns and choose the Unpivot feature within the transform tab.
3. Add an index column
4. Close and Apply
5. Add the scatter chart visualization to your report page
6. Add Index to the Details field
7. Add Attribute to the Legend field
8. Add Value to the X Axis
9. Add Sample Depth to the Y Axis
10. Add slicers for Attribute and Location to filter the chart based on what you want to see.
Does this solve your problem? Final product should look like
I get slightly different results to your graph but I added an index column (add column tab) to have a unqiue id for each row and then unpivoted the compound columns (select the compond columns and click unpivot from the transfor tab in the query editor). This gives then in the Attribute Field.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bZZbcm0hCETncr5TlAqofN7HLFKZ/zSu0nB03+TL7PhY0LR4Pj9fv14fL2GltsZKYw88yHh/FhpjjZNa36tozjXYIPbPTlz2WIn3qsbUbO9q1Hx3Jdnzc1Dn19fH/yjV2FyBkuao4mdSV/+vkm2mCJnsyIyGb6MiQABZMD1lJ3BQk/xsqntSGk3fhGwK9eLD9DXriLm/Ff9uADCVinC6f/lBK4MyD2WlgIQQeai08hEfAibT4zRqCipmO4aBUEbFPyvQckHYIWufeWa5Q+oDAlGWOlg8DOeZJzZiUQwR9HhAFHppZIL9HJnI2V+X9BUh9Hli10xB7Apor9yQ317wJa3P2Q5AVkZ6EiuoeyEtLleH8A1Oq0hoQYC0gQFyqVyQzETdz5N07+hU4WO4nGoNj7X9RzNYoTVAFTUz1HVAvtFJxsXpkYx7R94a99CYjxh1nVuh+VFlU+o4NowL17YJE8KmhLk5cO0mjlWYG/eHSkJ4erjO6ru+GxJurtNPtzxoXJRMpY+4aKDwwwMcHWCG9GFfdlnD04I5RQXMHox55NplKfcO7hdDifW+Ir5GEsyPO7ZQPzAa8uiRgD4GZ8w0X7oOvmj13JA113LuMEYwvBktRqpT77K7csZZ2R6TvmW3xCuPEftRjz9+6CQE5Ted31UPkSJG/5qWDO1n4Gw1kYeUTDUZWib1K4+ZejJQFcH53TPJO90vWRhVjvb2RilfDCM5zl5azX6Hk4yGekgUQvKczeAwVJgF++1opfv1ODpu746bkfUQ5BFtI/wdWvVxF6k/+lYyQit/EU7PLXfmrtyyh+mtlYCh8za0g9fbgTz+OqNGl3fPbu/icLXvjJVHPBp21jCELOhwBS77xpCLMdNQ2o5ps+Ytr1uo42taXpqISoczuL0Zsrrk9cSuB3JcT0fJejbfWN5vYRZEAZl30aOZlH5BjC7TL7HyfYpEECR+ipT2tv+8M4kveZhY7Q1hWwedANZPCNenwScVTWmFBciIZ6qg/AaLMFoxA9ZQmubt+2CyKMBE/RpuR81L4jrZOtZ/VqEoIx4vlJERyvoF5i/N3P3l6+sf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Location = _t, #"Sample depth (m)" = _t, #"Compound 1" = _t, #"Compound 2" = _t, #"Compound 3" = _t, #"Compound 4" = _t, #"Compound 5" = _t, #"Compound 6" = _t, #"Compound 7" = _t, #"Compound 8" = _t, #"Compound 9" = _t, #"Compound 10" = _t, #"Compound 11" = _t, #"Compound 12" = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1),
#"Changed Type" = Table.TransformColumnTypes(#"Added Index",{{"Location", type text}, {"Sample depth (m)", type number}, {"Compound 1", type number}, {"Compound 2", type number}, {"Compound 3", type number}, {"Compound 4", type number}, {"Compound 5", type number}, {"Compound 6", type number}, {"Compound 7", type number}, {"Compound 8", type number}, {"Compound 9", type number}, {"Compound 10", type number}, {"Compound 11", type number}, {"Compound 12", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Location", "Sample depth (m)", "Index"}, "Attribute", "Value")
in
#"Unpivoted Columns"I can then use the attribute on the legend and a slicer for the location. if you only have 4 locations you could also just have four copies of the scatter each filtered by a different location.
Try looking these visuals as it's got more options for a scatter.
https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104381101?tab=Overview
https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104380762?tab=Overview