cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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?)

Wilson_
Solution Specialist
Solution Specialist

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?)

 

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?)

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. 😄

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors