Forum Discussion
Bar chart with true/false ratio
Hello
I have a table with three columns true/false, let's call them isTested, isDeployed, and isAccepted. From these columns I need to create a bar chart that shows each of these columns in two colors representing the true/false ratio. This turns out to be much harder than I expected, and any help would be greatly appreciated!
Thank you
Stefaan
You have to unpivot your columns in Edit Query.
Copy-paste below query in the advance editor.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCgkKdVXSgVFujj7BINpQKVYnGs5Dp43AsmhaYLQxsiQqZaIUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [isTested = _t, isDeployed = _t, isAccepted = _t, ID = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"isTested", type logical}, {"isDeployed", type logical}, {"isAccepted", type logical}, {"ID", Int64.Type}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value"), #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Columns",{{"Value", "Status"}, {"Attribute", "StageCheck"}}) in #"Renamed Columns"check below the snapshots for your reference.
Actual table
After unpivot
Visual output.
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
1 Reply
- nandukrishnavs
Community Champion
You have to unpivot your columns in Edit Query.
Copy-paste below query in the advance editor.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCgkKdVXSgVFujj7BINpQKVYnGs5Dp43AsmhaYLQxsiQqZaIUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [isTested = _t, isDeployed = _t, isAccepted = _t, ID = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"isTested", type logical}, {"isDeployed", type logical}, {"isAccepted", type logical}, {"ID", Int64.Type}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"ID"}, "Attribute", "Value"), #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Columns",{{"Value", "Status"}, {"Attribute", "StageCheck"}}) in #"Renamed Columns"check below the snapshots for your reference.
Actual table
After unpivot
Visual output.
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂