cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Meena Regular Visitor
Regular Visitor

Subtract values in a measure for different categories

Hello community,

 

I am trying to implement mean score difference of two categories of survey questionnairs. Layout is a matrix.

'Mean response score' is the average of response score. Questionnaire categories- Initial and middle are selected by a slicer on the report.

Following is snapshot of my report:

mean score difference.PNG

I want to have a new measure that calculates the mean response score difference between intial and middle questionnaire categories.

 

Many thanks in advance,

Meena

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Subtract values in a measure for different categories

You should be able to do this with a measure something like the following (you might need to change the table reference, the code below assumes your table is called 'Survey') :

 

= CALCULATE( [Mean Response Score], 'Survey'[Category] = "Middle" )  - CALCULATE( [Mean Response Score], 'Survey'[Category] = "Initial" ) 

Community Support Team
Community Support Team

Re: Subtract values in a measure for different categories

hi, @Meena 

I'm afraid it couldn't achieve that add a custom column for matrix visual in Power BI for now.

As a workaround, you may try this way:

Select matrix visual, then click Format->column headers->word wrap, disable it.

Then adjust the width of the matrix column with difference measure.

6.JPG

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
Super User
Super User

Re: Subtract values in a measure for different categories

You should be able to do this with a measure something like the following (you might need to change the table reference, the code below assumes your table is called 'Survey') :

 

= CALCULATE( [Mean Response Score], 'Survey'[Category] = "Middle" )  - CALCULATE( [Mean Response Score], 'Survey'[Category] = "Initial" ) 

Meena Regular Visitor
Regular Visitor

Re: Subtract values in a measure for different categories

Thanks for the solution d_gosbell. It works! But I would like to have mean difference only in Total, not for each category(initial and Middle) as it is at present in following snapshot:

 

mean score difference1.PNG

Some existing solutions on this forum, suggest to turn off 'Totals' in General format of the matrix, but I don't see any 'totals' in general format:

totals.PNG

 

Please advise. The version of my Power BI desktop is :Version: 2.66.5376.1681 64-bit (February 2019)

Thanks,

Community Support Team
Community Support Team

Re: Subtract values in a measure for different categories

hi, @Meena 

I'm afraid it couldn't achieve that add a custom column for matrix visual in Power BI for now.

As a workaround, you may try this way:

Select matrix visual, then click Format->column headers->word wrap, disable it.

Then adjust the width of the matrix column with difference measure.

6.JPG

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Meena Regular Visitor
Regular Visitor

Re: Subtract values in a measure for different categories

Thanks for the work around v-lili6-msft. I really wish this is included as an improvement to matrix visual.

 

Thanks,

Meena

Helpful resources

Announcements
GregDeckler

How to Get Your Question Answered Quickly

Power BI Super User, Greg Deckler, explains

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Ideas
Users Online
Currently online: 41 members 922 guests
Please welcome our newest community members: