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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gmat
Helper I
Helper I

Matrix Total Line Representation

I'm currently working on a PowerBI project where I've constructed a matrix representing various categories of our unique identifiers, denoted by numbers displayed on the far left. Within this matrix, I've aggregated several metrics corresponding to these identifiers.

 

However, here's the challenge I'm encountering: While the matrix displays only a subset of the unique identifiers (specifically 7 out of 12 - 30/60/90/130/140/170/180), I want the total line to encompass the entire population of categories, not just the ones filtered in the matrix.

 

To illustrate further, I aim to have the total line represent all categories for the metrics displayed, irrespective of whether they are filtered within the matrix or not. Is it possible within PowerBI to configure the total line in a matrix to include the entire population of categories, rather than being limited to the filtered subset?

 

I appreciate the help!

 

gmat_0-1711381460764.png

 

1 ACCEPTED SOLUTION

@gmat See attached PBIX.

Measure = IF( HASONEVALUE('Table'[Class]), SUM('Table'[Revenue]), SUMX(ALL('Table'), [Revenue]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

@gmat You should be able to get around this using ALL and this method. First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , I am not sure I am following. The links you have given do not specifically answer my question. I am truly trying to figure out if I can total the unit count of the whole population in the totals column while still having the matrix filtered on a select few categories of the population. 

@gmat Correct, and I am saying you would do that using ALL to get rid of the filters and you would want to use HASONEVALUE to determine if you are in a total row or not. Without more details, sample data, etc. it's next to impossible to be specific as to the exact solution. All I can answer is that, yes, it should be possible and here is some guidance on how to do it.

 

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler , apologies for the lack of detail in my post. Below is a dataset that I have used to create the matrix in the following screenshot. What I am trying to do is keep the current selection of classes 30/40/50 but have the sum of units in the matrix = to total sum of all units (1450) and total sum of revenue in the matrix to be total sum of all revenue ($330,000).

gmat_0-1711384950098.png

 

 

 

ClassUnitsRevenue
20100$6,000
30110$12,000
40120$18,000
50130$24,000
60140$30,000
70150$36,000
80160$42,000
90170$48,000
100180$54,000
120190$60,000

@gmat See attached PBIX.

Measure = IF( HASONEVALUE('Table'[Class]), SUM('Table'[Revenue]), SUMX(ALL('Table'), [Revenue]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Great, thanks so much. I had to tweak the formula a bit to take into account all of the other filters but it worked!

Great, thanks so much. I had to tweak the formula a bit to take into account all of the other filters but it worked!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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