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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Matrix with Concatenated Measures and Correct Totals

I am trying to create a matrix that shows both the sum and count for each combination of two categorical variables. I have figured out a formula that gives me the right individuals cells and one that gives the right total rows, but not both at the same time.  Trying to use HASONEVALUE(), but it isn't working.
 
Dummy data:
CAT1CAT2VAR1
A1B10.25
A1B20.75
A1B20.5
A2B20.25
A2B20.5

 

Desired outcome:

 B1B2Total
A1.25 (1)    1.25 (2)  1.5 (3)
A2   .75 (2)  .75 (2)
Total.25 (1)    2 (4)  2.25 (5)

 

Thanks for the help!

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

I think you just need to drag field "var1" into the value of the matrix again and then change the type to " count"

 

pbix attached

 

70.png

 

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

I think you just need to drag field "var1" into the value of the matrix again and then change the type to " count"

 

pbix attached

 

70.png

 

Best Regards,
Community Support Team _ Eason

Greg_Deckler
Super User
Super User

@Anonymous - 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

 

Seems like you are headed down this track. You might try using ISINSCOPE instead of HASONEVALUE. Hard to say without knowing the measure formula. (hint)


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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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