Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Frozensparrow
Frequent Visitor

Showing total count Value in Bar Chart

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.

 

Frozensparrow_0-1678090504122.png

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Frozensparrow ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1678154705252.png

(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.

vtangjiemsft_2-1678155008655.pngvtangjiemsft_3-1678155053843.png

(5)Then the result is as follows.

vtangjiemsft_4-1678155096277.png

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. 

View solution in original post

Frozensparrow
Frequent Visitor

Thanks Neeko, you sample pbix allow me to understand better, and give me the idea on the approach. Thank you so much. 🙂

View solution in original post

2 REPLIES 2
Frozensparrow
Frequent Visitor

Thanks Neeko, you sample pbix allow me to understand better, and give me the idea on the approach. Thank you so much. 🙂

Anonymous
Not applicable

Hi @Frozensparrow ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

vtangjiemsft_0-1678154705252.png

(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.

vtangjiemsft_2-1678155008655.pngvtangjiemsft_3-1678155053843.png

(5)Then the result is as follows.

vtangjiemsft_4-1678155096277.png

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. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors