Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I got stuck, looking thru all the chart solution in this forum... still doesn't feel any enlightenment. I am trying to get the total count to appear on my bar chart. I have
- x-axis with the owner name
- y-axis with count of Overdue number
How do I get the total of overdue ( which the count should be total 6) onto that bar chart? Hope to get some pointer from the expert from this forum. Thanks a ton.
Solved! Go to Solution.
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')-1
Measure = 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.
Thanks Neeko, you sample pbix allow me to understand better, and give me the idea on the approach. Thank you so much. 🙂
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')-1
Measure = 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.
User | Count |
---|---|
75 | |
75 | |
40 | |
27 | |
24 |
User | Count |
---|---|
96 | |
93 | |
51 | |
45 | |
42 |