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
WuchaDoin
Frequent Visitor

Trying to get a simple count of sales in a matrix

I don't know why I am having such a hard time with this, but in this picture, there are a count of 7 sales (counted in red). Where '13' is circled in red; I need that number to be 7. I have tried all differnt methods of fields on the rows, columns, and values. Anyone know a simple solution to this? Basically I am needing a matrix that just counts the amount of sales for each site. This one has seven, but I can't get it to count on the other column where '13' is.

WuchaDoin_0-1665169793506.png

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @WuchaDoin 

 

You can try the following methods.

Measure = IF(HASONEVALUE('Table'[ITEM]),COUNT('Table'[ITEM]),DISTINCTCOUNT('Table'[ITEM]))

vzhangti_0-1665568476825.png

IF(HASONEVALUE()) This function controls the output of Total.
 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @WuchaDoin 

 

You can try the following methods.

Measure = IF(HASONEVALUE('Table'[ITEM]),COUNT('Table'[ITEM]),DISTINCTCOUNT('Table'[ITEM]))

vzhangti_0-1665568476825.png

IF(HASONEVALUE()) This function controls the output of Total.
 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so very much. I appreciate the help from everyone else, but this is exactly what I needed and now I can even study the line of code you used to better understand DAX at a simpiler level.

Greg_Deckler
Super User
Super User

@WuchaDoin Ding ding ding! Yet another measure totals problem most likely.

Please vote for this idea: Microsoft Idea (powerbi.com)

 

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

 

This might help as well: Matrix Measure Total Triple Threat Rock & Roll - Microsoft Power BI Community

BrainPowerBI.jpg

 


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