Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am attempting to create a scatter plot with several variables.
On the Y axis, should be displayed depths (such as a sample depth) and on the y-axis I'd like to show a concentration measurement. So for each depth showing the concentration measurement as a point on the graph.
Now where it gets complicated is I'm working with several different measureable compounds, so I would like to display each compound as it's own trend, I've created this in excel as such:
To make this even more complicated (and what I'm hoping powerBI will be great for) is now I have numerous different locations with this same sample data. I would like to be able to filter on each location and show the above graph so I can easily compare the trends and values. The sample depths will not all be the exact same, but will all be within a reasonable range, and with the filtering I am hoping the graph will fit the shown data.
As of right now I'm only able to show 1 compound at a time... I've been using the "Legend" for the location but unfortunately I can't think of a way to categorize by the compound type because each measurement depth has many compound measurements.
Example data set:
Location | Sample depth (m) | Compound 1 | Compound 2 | Compound 3 | Compound 4 | Compound 5 | Compound 6 | Compound 7 | Compound 8 | Compound 9 | Compound 10 | Compound 11 | Compound 12 |
A | 435.2 | 1.72 | 37.93 | 10.77 | 8.26 | 4.88 | 97.36 | 46.30 | 41.37 | 23.29 | 12.23 | 11.40 | 87.63 |
A | 435.2 | 1.55 | 41.31 | 10.42 | 8.00 | 4.65 | 105.98 | 44.94 | 39.75 | 4.04 | 11.29 | 10.94 | 84.72 |
A | 438.1 | 1.14 | 42.84 | 1.26 | 0.60 | 0.81 | 110.80 | 5.60 | 2.04 | 3.01 | 4.66 | 3.14 | 35.08 |
A | 441.2 | 1.00 | 44.88 | 0.44 | 0.26 | 0.48 | 109.25 | 0.84 | 0.64 | 0.70 | 0.71 | 0.61 | 3.04 |
A | 443.2 | 0.89 | 43.70 | 0.41 | 0.26 | 0.44 | 114.02 | 0.79 | 0.69 | 5.76 | 0.46 | 0.42 | 1.07 |
A | 443.5 | 1.15 | 44.89 | 0.34 | 0.24 | 0.46 | 111.10 | 0.68 | 0.71 | 5.71 | 0.49 | 0.44 | 1.10 |
B | 412.0 | 0.92 | 40.85 | 0.89 | 0.65 | 0.50 | 106.66 | 2.30 | 1.79 | 5.78 | 0.97 | 0.91 | 3.54 |
B | 413.5 | 1.52 | 38.58 | 6.16 | 4.72 | 3.11 | 105.21 | 29.81 | 22.66 | 5.48 | 9.00 | 7.76 | 76.47 |
B | 416.0 | 0.80 | 45.76 | 0.66 | 0.43 | 0.49 | 122.12 | 1.44 | 1.10 | 5.17 | 0.81 | 0.77 | 2.60 |
B | 395.1 | 0.87 | 46.83 | 0.51 | 1.31 | 1.09 | 122.38 | 7.12 | 6.07 | 5.04 | 3.18 | 2.97 | 46.87 |
B | 396.0 | 0.67 | 39.73 | 0.39 | 0.34 | 0.38 | 97.87 | 0.94 | 0.73 | 4.84 | 0.47 | 0.55 | 1.99 |
B | 396.8 | 0.80 | 38.50 | 0.47 | 0.36 | 0.38 | 95.35 | 0.64 | 0.47 | 4.87 | 0.38 | 0.44 | 0.55 |
B | 396.8 | 0.82 | 39.69 | 0.35 | 0.35 | 0.38 | 98.85 | 0.65 | 0.52 | 3.21 | 0.42 | 0.62 | 0.52 |
B | 397.8 | 0.75 | 39.34 | 0.31 | 0.43 | 0.39 | 93.81 | 0.61 | 0.45 | 3.63 | 0.38 | 0.74 | 0.37 |
C | 398.5 | 0.70 | 36.83 | 0.36 | 0.21 | 0.36 | 89.81 | 0.56 | 0.56 | 3.25 | 0.42 | 0.40 | 0.65 |
C | 508.6 | 0.75 | 38.44 | 0.33 | 0.18 | 0.30 | 94.49 | 0.62 | 0.62 | 3.55 | 0.48 | 0.42 | 0.53 |
C | 509.4 | 0.77 | 39.86 | 0.40 | 0.18 | 0.32 | 98.45 | 0.54 | 0.53 | 3.37 | 0.50 | 0.46 | 0.97 |
C | 510.4 | 0.74 | 39.77 | 0.40 | 0.43 | 0.34 | 94.97 | 0.73 | 0.56 | 3.67 | 0.61 | 0.64 | 1.10 |
C | 510.6 | 0.71 | 40.26 | 0.40 | 0.42 | 0.33 | 97.95 | 0.62 | 0.46 | 3.58 | 0.64 | 0.56 | 1.27 |
D | 511.2 | 0.69 | 39.60 | 0.59 | 0.42 | 0.33 | 94.90 | 0.79 | 0.59 | 3.32 | 0.72 | 0.63 | 1.27 |
D | 511.4 | 0.69 | 38.36 | 0.52 | 0.39 | 0.30 | 92.87 | 0.67 | 0.52 | 2.85 | 0.59 | 0.57 | 1.32 |
D | 476.6 | 0.60 | 41.74 | 0.46 | 0.37 | 0.27 | 100.84 | 0.73 | 0.55 | 2.88 | 0.50 | 0.55 | 1.06 |
D | 479.1 | 0.56 | 39.24 | 0.42 | 0.35 | 0.23 | 102.40 | 0.68 | 0.52 | 2.68 | 0.45 | 0.48 | 0.59 |
D | 390.3 | 0.55 | 42.39 | 2.61 | 1.47 | 1.03 | 107.30 | 10.95 | 9.26 | 3.12 | 3.68 | 2.72 | 20.51 |
D | 391.4 | 0.55 | 40.72 | 2.18 | 1.18 | 0.84 | 99.20 | 8.67 | 7.21 | 2.36 | 3.03 | 2.22 | 18.38 |
Thanks for anyones help with this!!
Solved! Go to Solution.
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
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
Hi Experts,
I am trying to build an scatter chart of X (from K-S columns in the excel sheet image) and Y points (from T to AB columns) arranged in rows within the data file, each row corresponds to a particular object (@name()) and it varies with time (each row represents the object and the date were the X-Y points were recorded), the goal is to build a similar plot to the one shown (i.e. PCCA-001A with coordinates Xn,Yn as: Q_PR, PR/ Q_0.75, PR_0.75…Q_0, PR_0). I tried first to unpivot those X,Y points, then to use an index (1 instead of PR, 0.75, 0.5, 0.4, 0.3, 0.2, 0.1, 0) as suggested here but it did not work out. Any possible solution it would be great. Or if it is possible to plot the scatter without unpivoting let me know.
Best regards,
LG
Perfect, thank you!
Now that we've come this far, I'm wondering if we can do it 1 more...
If we filter on say compound 1 & 2 they will show up as 2 distinct colors. However, there's no easy way to discern which location we are viewing (by way of symbol or size or something like that). I tried putting the location in for color saturation but it wouldn't take.
Any idea on how to visualize/filter this way?
The enhanced scatter has a shape field. If you create a numerical version of the locations you can give them one of these shapes.
circle - 0
cross - 1
diamond - 2
square - 3
triangle-up - 4
triangle-down - 5
star - 6
hexagon - 7
x - 8
up arrow - 9
down arrow - 10
Excellent I will try this. The enhanced scatter seems useful but at first I was getting an error about string and aggregate data when trying to use the shape option. This was before seeing your response however so I will reformat my data and see if this works.