Forum Discussion

Forrestgump's avatar
Forrestgump
Frequent Visitor
8 years ago
Solved

create a bar chart with an average line running through

Hi All,

I am trying to create a bar chart with an average line running through. The matrix button works as below:-

[CODE]

Function% Complete
Function 154.50%
Function 240.00%
Function 334.60%
Function 433.30%
Function 523.20%
Function 621.40%
Function 720.00%
Function 818.50%
Function 917.80%
Function 1017.80%
Function 1117.50%
Function 1216.60%
Function 1314.90%
Function 1413.50%
Function 1513.20%
Function 1612.80%
Function 1711.80%
Function 1810.20%
Function 1910.10%
Function 209.40%
Function 218.90%
Function 228.80%
Function 238.00%
Function 247.90%
Function 256.70%
Function 266.70%
Function 275.80%
Function 285.10%
Function 293.10%
Function 302.90%
Function 312.60%
Function 322.60%
Function 332.60%
Function 341.90%
Function 350.00%
Function 360.00%
Function 370.00%
Function 380.00%

[/CODE]

The average over the total should be 10.8% because the total number of completes for all functions is 789 and the total number eligible is 7272 which is 10.8%. However, when i turn on the average line in power bi it comes out at 12.8%. Which is basically all the percentages added together 484.7% divide by the number of functions i.e. 38 = 12.8%.

The formula I am using for the percentage calc is:-

[CODE]% Complete = IF(ISBLANK([Survey Complete]/([Survey Complete]+[Survey Not Complete])),0,[Survey Complete]/([Survey Complete]+[Survey Not Complete]))[/CODE]

I also tried to create an average measure (which calculates correctly);-

[CODE]Average = Divide(Calculate([Survey Complete],ALLSELECTED(HeadcountData)),Calculate([Eligible Employees],ALLSELECTED(HeadcountData)))[/CODE]

However, I am unable to create the graph with the correct average over the functions. Any help would be greatly appreciated.

Kind regards,

Forrestgump

12 Replies

    • Forrestgump's avatar
      Forrestgump
      Frequent Visitor

      Hi Greg,

       

      Thanks for your reply. If the dotted line running through the chart is 10.8 then yes. Is the dotted line 10.8%?

       

      Kind regards,

       

      Forrest

       

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        The average in Excel is 12.8%. The one displayed in Power BI is .13 (same if you increase decimal count). I'm not understanding how you are getting your average as your method seems to disagree with Excel. Apparently your concept of average is different than the standard way of conceptualizing average. What you are asking for is the overall % complete, not an average of % complete. You would do that by creating a measure that essentially does this:

         

        Measure = COUNTX(FILTER(ALL('Table'),[Column]="Complete"),[Column]) / COUNTX(ALL('Table'),[Column])

         

        Difficult to say exactly without source data, which is what I thought you provided but apparently not. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490