Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi, I'm Power BI newbie. I'm trying to generate the card (above) to display the total of top 2 survey results. In this case 52% + 35%. Please guide how to calculate this. Thank you.
Solved! Go to Solution.
Hey @jambopriti ,
Please provide sample data used to create the Donut chart; otherwise, creating a calculation that honors your data is impossible. Make sure that the sample data reflects your semantic model, meaning tables, relationships, calculated columns, and measures.
Regards,
Tom
you can try this
Proud to be a Super User!
Hey @jambopriti ,
This DAX statement creates a measure that finds the Top 2 answers per question (assuming a slicer filters a question), calculates the share of the Top 2 answers, and finally creates a string. Please be aware that I called your sample data "pie". Of course, you have to adapt this to the name of your table.
The other thing that might be adapted is the target value:
Top 2 Box =
var theTargetValue = 80
var noOfRowsSelected = COUNTROWS( ALLSELECTED( 'pie' ) )
var theTop2 =
TOPN(
2,
ADDCOLUMNS(
summarize(
ALLSELECTED( 'pie' ),
'pie'[answer]
),
"c" , CALCULATE( COUNTROWS( 'pie' ) )
),
[c]
)
var theTop2_sum =
SUMX( theTop2 , [c] )
return
INT(DIVIDE( theTop2_sum , noOfRowsSelected) * 100) & "% vs Target of " & theTargetValue & "%"
This is how it looks if the measure is used on a Card visual (next to the Donut chart):
Hopefully, this will provide what you are looking for.
Regards,
Tom
Thank you TomMartens,
This one is working for one question but I'm finding difficulties in other questions.
I'm attaching the sample data and the visual what I'm trying to create. Again sorry I'm new to PowerBi and this is so dumn question. Thanks for your help!
in this visual the top 2 responses are not correct.
TestData:
| Respondent_id | question | answer |
| 5751 | How satisfied are you with the web site experience? | Very Satisfied |
| 5751 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5752 | How satisfied are you with the web site experience? | Satisfied |
| 5752 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5753 | How satisfied are you with the web site experience? | Very Satisfied |
| 5753 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5760 | How satisfied are you with the web site experience? | Very Satisfied |
| 5760 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5761 | How satisfied are you with the web site experience? | Satisfied |
| 5761 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5762 | How satisfied are you with the web site experience? | Very Satisfied |
| 5762 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5763 | How satisfied are you with the web site experience? | Neutral |
| 5763 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5764 | How satisfied are you with the web site experience? | Very Satisfied |
| 5764 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5767 | How satisfied are you with the web site experience? | Very Satisfied |
| 5767 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5769 | How satisfied are you with the web site experience? | Satisfied |
| 5769 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Difficult |
| 5770 | How satisfied are you with the web site experience? | Very Satisfied |
| 5770 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5772 | How satisfied are you with the web site experience? | Satisfied |
| 5772 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5775 | How satisfied are you with the web site experience? | Very Satisfied |
| 5775 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5776 | How satisfied are you with the web site experience? | Satisfied |
| 5776 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5778 | How satisfied are you with the web site experience? | Very Satisfied |
| 5778 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5779 | How satisfied are you with the web site experience? | Very Satisfied |
| 5779 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5780 | How satisfied are you with the web site experience? | Very Satisfied |
| 5780 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5781 | How satisfied are you with the web site experience? | Satisfied |
| 5781 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5783 | How satisfied are you with the web site experience? | Very Satisfied |
| 5783 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5785 | How satisfied are you with the web site experience? | Satisfied |
| 5785 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5787 | How satisfied are you with the web site experience? | Neutral |
| 5787 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5788 | How satisfied are you with the web site experience? | Very Satisfied |
| 5788 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5789 | How satisfied are you with the web site experience? | Neutral |
| 5789 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5790 | How satisfied are you with the web site experience? | Very Satisfied |
| 5790 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very difficult |
| 5791 | How satisfied are you with the web site experience? | Very Satisfied |
| 5791 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5792 | How satisfied are you with the web site experience? | Neutral |
| 5792 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5793 | How satisfied are you with the web site experience? | Satisfied |
| 5793 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5795 | How satisfied are you with the web site experience? | Very Satisfied |
| 5795 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5796 | How satisfied are you with the web site experience? | Satisfied |
| 5796 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5797 | How satisfied are you with the web site experience? | Satisfied |
| 5797 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Neither easy nor difficult |
| 5799 | How satisfied are you with the web site experience? | Satisfied |
| 5799 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Easy |
| 5800 | How satisfied are you with the web site experience? | Very Satisfied |
| 5800 | With your intended purpose in mind, how easy or difficult was it to find / do what you were hoping to on the site today? | Very easy |
| 5801 | How satisfied are you with the web site experience? | Dissatisfied |
| 5802 | How satisfied are you with the web site experience? | Very Dissatisfied |
Hey @jambopriti ,
just create a visual level filter that "filters" the question, do this for the card visual and the donut chart!
Regards,
Tom
you can try this
Proud to be a Super User!
Thank You ryan_mayu.
It is working for my 2 survey questions. is there a way instead of hard coded the answer (ex: Very Satisfied & satisfied ) it can be dynamic? so if there are no value lets say satisfied then it will pick up Neutral which is next answer? Thanks you in advance.
@jambopriti
This is exactly what my measure is doing! It finds the top 2 categories per question.
Regards,
Tom
Perfect!!
Thanks Tom. It is working. Thank you so much for the guidance and solution!!
Respondent_id,question,answer
5751,How satisfied are you with the web site experience?,Very Satisfied
5752,How satisfied are you with the web site experience?,Satisfied
5753,How satisfied are you with the web site experience?,Very Satisfied
5760,How satisfied are you with the web site experience?,Very Satisfied
5761,How satisfied are you with the web site experience?,Satisfied
5762,How satisfied are you with the web site experience?,Very Satisfied
5763,How satisfied are you with the web site experience?,Neutral
5764,How satisfied are you with the web site experience?,Very Satisfied
5767,How satisfied are you with the web site experience?,Very Satisfied
5769,How satisfied are you with the web site experience?,Satisfied
5770,How satisfied are you with the web site experience?,Very Satisfied
5772,How satisfied are you with the web site experience?,Satisfied
5775,How satisfied are you with the web site experience?,Very Satisfied
5776,How satisfied are you with the web site experience?,Satisfied
5778,How satisfied are you with the web site experience?,Very Satisfied
5779,How satisfied are you with the web site experience?,Very Satisfied
5780,How satisfied are you with the web site experience?,Very Satisfied
5781,How satisfied are you with the web site experience?,Satisfied
5783,How satisfied are you with the web site experience?,Very Satisfied
5785,How satisfied are you with the web site experience?,Satisfied
5787,How satisfied are you with the web site experience?,Neutral
5788,How satisfied are you with the web site experience?,Very Satisfied
5789,How satisfied are you with the web site experience?,Neutral
5790,How satisfied are you with the web site experience?,Very Satisfied
5791,How satisfied are you with the web site experience?,Very Satisfied
5792,How satisfied are you with the web site experience?,Neutral
5793,How satisfied are you with the web site experience?,Satisfied
5795,How satisfied are you with the web site experience?,Very Satisfied
5796,How satisfied are you with the web site experience?,Satisfied
5797,How satisfied are you with the web site experience?,Satisfied
5799,How satisfied are you with the web site experience?,Satisfied
5800,How satisfied are you with the web site experience?,Very Satisfied
Hey @jambopriti ,
Please provide sample data used to create the Donut chart; otherwise, creating a calculation that honors your data is impossible. Make sure that the sample data reflects your semantic model, meaning tables, relationships, calculated columns, and measures.
Regards,
Tom
Thank you. I'm so new to the forum as well.
Here is the test data:
| Respondent_id | question | answer |
| 5751 | How satisfied are you with the web site experience? | Very Satisfied |
| 5752 | How satisfied are you with the web site experience? | Satisfied |
| 5753 | How satisfied are you with the web site experience? | Very Satisfied |
| 5760 | How satisfied are you with the web site experience? | Very Satisfied |
| 5761 | How satisfied are you with the web site experience? | Satisfied |
| 5762 | How satisfied are you with the web site experience? | Very Satisfied |
| 5763 | How satisfied are you with the web site experience? | Neutral |
| 5764 | How satisfied are you with the web site experience? | Very Satisfied |
| 5767 | How satisfied are you with the web site experience? | Very Satisfied |
| 5769 | How satisfied are you with the web site experience? | Satisfied |
| 5770 | How satisfied are you with the web site experience? | Very Satisfied |
| 5772 | How satisfied are you with the web site experience? | Satisfied |
| 5775 | How satisfied are you with the web site experience? | Very Satisfied |
| 5776 | How satisfied are you with the web site experience? | Satisfied |
| 5778 | How satisfied are you with the web site experience? | Very Satisfied |
| 5779 | How satisfied are you with the web site experience? | Very Satisfied |
| 5780 | How satisfied are you with the web site experience? | Very Satisfied |
| 5781 | How satisfied are you with the web site experience? | Satisfied |
| 5783 | How satisfied are you with the web site experience? | Very Satisfied |
| 5785 | How satisfied are you with the web site experience? | Satisfied |
| 5787 | How satisfied are you with the web site experience? | Neutral |
| 5788 | How satisfied are you with the web site experience? | Very Satisfied |
| 5789 | How satisfied are you with the web site experience? | Neutral |
| 5790 | How satisfied are you with the web site experience? | Very Satisfied |
| 5791 | How satisfied are you with the web site experience? | Very Satisfied |
| 5792 | How satisfied are you with the web site experience? | Neutral |
| 5793 | How satisfied are you with the web site experience? | Satisfied |
| 5795 | How satisfied are you with the web site experience? | Very Satisfied |
| 5796 | How satisfied are you with the web site experience? | Satisfied |
| 5797 | How satisfied are you with the web site experience? | Satisfied |
| 5799 | How satisfied are you with the web site experience? | Satisfied |
| 5800 | How satisfied are you with the web site experience? | Very Satisfied |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.