Forum Discussion
Showing total count Value in Bar Chart
- Anonymous3 years ago
Hi Frozensparrow ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) Click "Transform Data" to enter the Power Query Editor, click "Advanced Editor" to copy and paste the following code, you can check the steps in the right step bar.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitXBznLCwnKGsGIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Owner = _t, OverDue = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Owner", type text}, {"OverDue", Int64.Type}}), #"Transposed Table" = Table.Transpose(#"Changed Type"), #"Added Custom" = Table.AddColumn(#"Transposed Table", "Custom", each "Total"), #"Transposed Table1" = Table.Transpose(#"Added Custom"), #"Replaced Value" = Table.ReplaceValue(#"Transposed Table1","Total","",Replacer.ReplaceValue,{"Column2"}), #"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value",{{"Column2", type number}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Column1", "Owner"}, {"Column2", "OverDue"}}) in #"Renamed Columns"(3)Click "Close and Apply" and we can create two calculated columns and two measures.
count = COUNTROWS(FILTER('Table','Table'[Owner]=EARLIER('Table'[Owner])))total = COUNTROWS('Table')-1Measure = IF(MAX('Table'[OverDue])=BLANK(),MAX('Table'[total]),MAX('Table'[count]))color = IF(MAX('Table'[Owner])="Total",1,0)(4)Set the conditional formatting as shown in the following figure.
(5)Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 3 years ago
Thanks Neeko, you sample pbix allow me to understand better, and give me the idea on the approach. Thank you so much. 🙂
Hi Frozensparrow ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) Click "Transform Data" to enter the Power Query Editor, click "Advanced Editor" to copy and paste the following code, you can check the steps in the right step bar.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitXBznLCwnKGsGIB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Owner = _t, OverDue = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Owner", type text}, {"OverDue", Int64.Type}}),
#"Transposed Table" = Table.Transpose(#"Changed Type"),
#"Added Custom" = Table.AddColumn(#"Transposed Table", "Custom", each "Total"),
#"Transposed Table1" = Table.Transpose(#"Added Custom"),
#"Replaced Value" = Table.ReplaceValue(#"Transposed Table1","Total","",Replacer.ReplaceValue,{"Column2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value",{{"Column2", type number}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type1",{{"Column1", "Owner"}, {"Column2", "OverDue"}})
in
#"Renamed Columns"
(3)Click "Close and Apply" and we can create two calculated columns and two measures.
count = COUNTROWS(FILTER('Table','Table'[Owner]=EARLIER('Table'[Owner])))total = COUNTROWS('Table')-1Measure = IF(MAX('Table'[OverDue])=BLANK(),MAX('Table'[total]),MAX('Table'[count]))color = IF(MAX('Table'[Owner])="Total",1,0)
(4)Set the conditional formatting as shown in the following figure.
(5)Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.