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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jonatan_ap
Helper I
Helper I

Insert a diferent calculated measure in a Matrix

Hi,

I have the following Matrix with Questions and Answers as columns and rows headers (2 different tables). 

jonatan_ap_2-1681533919934.png

If I export the table I have this:

jonatan_ap_4-1681533991595.png

I'm trying to insert the percentage per question beside each count of question*answer like shown in the table below highlighted in yellow

jonatan_ap_5-1681534561779.png

Is that something doable in Power BI?

1 ACCEPTED SOLUTION

Thank you Wilson,

After reading and reading in Google for possible solutions, I found that there is a native option called Percent of Row total (see screenshot below) that does exactly what I was looking for, I just needed to put the same field as a Value and select this option and that was it:

jonatan_ap_0-1681758025158.png

This is the final result:

jonatan_ap_2-1681758116180.png

Thank you for your help!

 

View solution in original post

7 REPLIES 7
jonatan_ap
Helper I
Helper I

Hi Wilson,

I actually have 2 tables, 1 for Questions (it's a fact table so contains more than just questions but to be simple let's call it Questions) and 1 for Answers, and in the Questions table I have the reference Answer Key to only 1 Answer as only 1 Answer can be picked per Question. The solution you proposed works fone if I have only 1 table. I appreciate the time you spend in this question. Thanks.

Jonatan,

 

In that case, I suspect there's a chance the measure would still work if you change the REMOVEFILTER to instead be REMOVEFILTERS ( Answers[Answer] ).

 

If that doesn't work, can you share a screenshot of the Model view from your pbix? Also, does the matrix row come from the Questions fact table and the matrix column from the Answers (dimension?) table?


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Wilson_
Super User
Super User

Hello Jonatan,

 

Yes, this is doable in Power BI.

 

Assuming this is the only table in your data model, the measure would look something like this:

 

AnswerPercentage =
VAR TotalAnswers = 
CALCULATE (
    SUM ( Table1[#] ),
    REMOVEFILTERS ( Table1[Answers] )
)

RETURN
DIVIDE (
    SUM ( Table1[#] ),
    TotalAnswers
)

 

----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi Wilson,

It didn't work, returned 1 for all cells:

 

I created the measure like this:

AnswerPercentage =
VAR TotalAnswers =
CALCULATE (
    SUM ( 'fact QA_Evaluations_Questions_Answers_Fact'[Answer_Id_Selected] ),
    REMOVEFILTERS ( 'dim QA_Answers_Selected_Dim'[Answer_Key] )
)

RETURN
DIVIDE (
    SUM ( 'fact QA_Evaluations_Questions_Answers_Fact'[Answer_Id_Selected] ),
    TotalAnswers
)

jonatan_ap_0-1681595203016.png

This is the model:

jonatan_ap_1-1681595469214.png

 

Jonatan,

 

What if you turn off bi-directional filtering between the two tables? Generally speaking, one-to-many relationships should only go in one direction.


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you Wilson,

After reading and reading in Google for possible solutions, I found that there is a native option called Percent of Row total (see screenshot below) that does exactly what I was looking for, I just needed to put the same field as a Value and select this option and that was it:

jonatan_ap_0-1681758025158.png

This is the final result:

jonatan_ap_2-1681758116180.png

Thank you for your help!

 

Excellent, glad you figured it out jonatan. 😄




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.