Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mbug123
Frequent Visitor

Calculating percentages with SELECTEDVALUE doesn't display totals

Hello, 

 

I found it surprisingly difficult to calculate percentages in DAX. I finally came up with the following:

 

overall_% = SELECTEDVALUE(a_fact_results[no_responses])/SELECTEDVALUE(a_fact_results[base])
 
It gives me the correct percentages but does not give me any totals when displaying in a matrix table. 
 
Why is this, and how can I change my code to display totals? 
3 REPLIES 3
Anonymous
Not applicable

Hi @mbug123 ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_Binbin Yu

mbug123
Frequent Visitor

Many thanks. I used your code. Unfortunately, still no totals ;( 

BeaBF
Super User
Super User

@mbug123 Hi! Change it to:
overall_% =
DIVIDE(
SELECTEDVALUE(a_fact_results[no_responses]),
SELECTEDVALUE(a_fact_results[base]),
0
)

In this updated expression, I've used the DIVIDE function instead of the division operator (/) to handle the case where the denominator is zero (to avoid errors). The SELECTEDVALUE function still retrieves the values for no_responses and base, but by using DIVIDE, it will correctly display totals in your matrix table.

 

BBF

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.