Forum Discussion
Calculate percentage for donut chart
- Anonymous2 years ago
Hi Anonymous
Thanks for your quick reply, if you want to display '0%', you need to change the donut chart to table visual, because the donut chart cannot display the value '0' , and change the measure to the following.
MEASURE = VAR a = CALCULATE ( DISTINCTCOUNT ( 'Table'[Linked Issue] ), 'Table'[Status] = "Closed" ) VAR b = CALCULATE ( COUNTA ( 'Table'[Linked Issue] ), ALLSELECTED ( 'Table' ), 'Table'[Project Name] IN VALUES ( 'Table'[Project Name] ) ) RETURN IF ( a > 0, DIVIDE ( a, b ), 0 )Then it can display.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
You can refer to the following solution.
The query you have offered cannot use, so i create a sample data
Sample data
You can create a measure
MEASURE =
VAR a =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Linked Issue] ),
'Table'[Status] = "Closed"
)
VAR b =
CALCULATE (
COUNTA ( 'Table'[Linked Issue] ),
ALLSELECTED ( 'Table' ),
'Table'[Project Name] IN VALUES ( 'Table'[Project Name] )
)
RETURN
DIVIDE ( a, b )
Then change the measure format to percentage and keep two decimal numbers
Then put the measure to the donut chart,and change the label contents, set it only display value.
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous, thank you so much for the advice. I have tried but the Measure (% Completion) will only show the project with closed task as below.
I want to have the project without closed task calculated as well.
In the end, i would like to have:
MLOps Project = 50%
LLMOps = 0%
MLOps for NPU = 0%
LLM-RAG = 0%
Wifi Sensing Activity Recognition = 0%
- Anonymous2 years agoNot applicable
Hi Anonymous
Thanks for your quick reply, if you want to display '0%', you need to change the donut chart to table visual, because the donut chart cannot display the value '0' , and change the measure to the following.
MEASURE = VAR a = CALCULATE ( DISTINCTCOUNT ( 'Table'[Linked Issue] ), 'Table'[Status] = "Closed" ) VAR b = CALCULATE ( COUNTA ( 'Table'[Linked Issue] ), ALLSELECTED ( 'Table' ), 'Table'[Project Name] IN VALUES ( 'Table'[Project Name] ) ) RETURN IF ( a > 0, DIVIDE ( a, b ), 0 )Then it can display.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous2 years agoNot applicable
Hi Anonymous thank you so much for the help. It works perfectly now! 🙂