Forum Discussion
Percentage Calculation in Power BI
I need to calculate the percentage based on the number of programs with a "Yes" response and how many are planned or have a "No" response. However, the challenge is that each program consists of multiple service orders, each with its own Service Order Status, which can be "Yes," "No," or "Planned."
Data Example:
PROGRAM CODE | Service Order # | Service Order Status |
ABC1234 | IA | Planned |
ABC1234 | 1B | Planned |
ABC1234 | 1c | Yes |
ABC1234 | 2D | Yes |
ABC1238 | 4A | Planned |
ABC1239 | 7A | Under Assessment |
ABC1240 | 2C | Under Assessment |
ABC1241 | 2F | Under Assessment |
ABC1242 | 7C | No |
ABC1243 | 8C | No |
ABC1244 | 2D | Under Assessment |
ABC1240 | 4D | Under Assessment |
ABC1240 | 6D | Under Assessment |
ABC1242 | 9D | Yes |
ABC1243 | 1D | Under Assessment |
ABC1242 | 1H | Yes |
ABC1243 | 2H | Planned |
ABC1238 | 3H | Under Assessment |
ABC1239 | IJ | Yes |
ABC1238 | 5J | Yes |
ABC1239 | 6Y | Yes |
Here's the tricky part: If a program has a "Yes" response for one service order but a "No" or "Planned" response for another service order under the same program, we should count it as a "Yes" for that program and disregard the other responses.
- Service Order Status Response = Yes: This counts as a "Yes" for a program.
- Service Order Status Response = Planned: This only considers unique program numbers without other responses.
- Service Order Status Response = No: This also only considers unique program numbers without other responses.
The goal is to ensure that when we add up the percentages, it should total 100%. Currently, my results show that the percentage with "Yes" is accurate, but the percentages for the other categories are incorrect.
Please advise on how I can achieve this accurately. Thank you.
10 Replies
- Dangar332Resident Rockstar
- aishaakhter18Helper I
I have not use DAX for it, I am using %GT calculation in X Axis to get percentage, but t giving me incorrect one
- ronrsnfldSuper User
What would you consider the correct result? How are you handling the "Under Assessment" option? I get very different results for "Yes"
- ronrosenfeldFrequent Visitor
- Providing results from data you have not posted is not useful. If the results I show do not match the data you did post, then I cannot help you further. . Good luck.
- AnonymousNot applicable
Hi aishaakhter18 ,
Is this your expected output?
Please check the attachment.Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum