Forum Discussion

Kalachuchi's avatar
Kalachuchi
Helper III
5 years ago
Solved

Donut chart problem

Hello guys I'm a newbie with powerbi,

So I have three measure for pending, completed and total number of surveys

Pending = CALCULATE(DISTINCTCOUNT('Table2'[EID]),FILTER('Table2','Table2'[Status] = "Pending"))
Completed= CALCULATE(DISTINCTCOUNT('Table2'[EID]),FILTER('Table2','Table2'[Status] = "Completed"))
Total Number of Survey = [Pending] + [Completed]

I want to have a donut chart where it will show the percentage of Pending and completed

So I put a legend of Status column where it is indicated Pending and total - so I can also filter them since I have a table below the donut where if clicked pending it will only show pending items.

but every time I put pending and completed measure on the donut chart it goes 100% and 100% - after making it a percentage of grand total - how can I change the total to the Total Number of Survey instead of getting the total of pending and completed as a reason of getting two 100%?

I also tried to divide the pending measure to the number of total surveys and get the expected result. however, it doesn't round 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Kalachuchi 

    Build a sample table to have a test.

    You may try this measure.

    Measure = 
    Var _Discount = CALCULATE(DISTINCTCOUNT(Table2[EID]),FILTER(ALL(Table2),Table2[Status]=MAX(Table2[Status])))
    Var _Total = CALCULATE(DISTINCTCOUNT(Table2[EID]),ALL(Table2))
    Return
    _Discount/_Total

    Build a donut visual and select Data value in Detail labels in Format. Result is as below.

    Use a Slicer it will still show the perentage of total.

    You can download the pbix file from this link: Donut chart problem

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

2 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion
    Can you share a screenshot or sample data maybe please?

    Have you tried putting [Status] in legend and [EID] in values with the summarization of EID set to Distinct Count?

    You shouldn't need any measures and just show values as no calculation because the pie chart will calculate the percentages for you.

    When you click on a pending in the table below, that will change the pie chart, but should highlight if you haven't changed the default settings...
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Kalachuchi 

    Build a sample table to have a test.

    You may try this measure.

    Measure = 
    Var _Discount = CALCULATE(DISTINCTCOUNT(Table2[EID]),FILTER(ALL(Table2),Table2[Status]=MAX(Table2[Status])))
    Var _Total = CALCULATE(DISTINCTCOUNT(Table2[EID]),ALL(Table2))
    Return
    _Discount/_Total

    Build a donut visual and select Data value in Detail labels in Format. Result is as below.

    Use a Slicer it will still show the perentage of total.

    You can download the pbix file from this link: Donut chart problem

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.