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
ChPetru
Helper I
Helper I

Percentage of customers that bought X quantity

Hello,

 

I am trying to make a matrix visual in which I have the Product Quantity (across all account opportunities) on columns and account value on the rows. Values in the matrix should be the Number of Accounts with that product quantity divided to number of customers in the Account Value bracket. Something like below.

I have issues with: Quantity (since it's at opportunity level in my table, an account will appear twice if he has bought the same product twice on different opportunities. I want the product quantity at account level; this calculated column did not help: 

_Quantity Account Level = CALCULATE(sum(Transactional[Quantity]),Accounts[Account ID ]=EARLIER(Transactional[Account ID ]),Transactional[Product]=EARLIER(Transactional[Product]))
 
Also, i created a measure to show me the percentage of accounts for each quantity, that also ain't working fine since at matrix row level the percentages do not add to 100%:
 
Percentage of Accounts = DIVIDE(CALCULATE([_Number of Distinct Accounts],ALL(Accounts[_Account Value])),CALCULATE(Accounts[_Number of Distinct Accounts],ALL(SFDC[Quantity]),ALL(SFDC[Product])))

 

Filters:Product1        
          
Account Value / Quantity12345678x
$0-$1000         
$1000-$2000         
$2000-$3000         
          
          
Accounts Transactional       
Account ID Account ID1Opportunity1Product1Quantity    
Account Value Account ID1Opportunity2Product2Quantity    
  Account ID2Opportunity3Product3Quantity    
  Account ID2Opportunity 4Product 1Quantity    

 

 

Not sure if anyone can help defining the two measures to work as intended.

 

Expected Output:

Filters:Product1         
          Row Total
Account Value / Quantity12345678x 
$0-$10002%0%0%5%0%.........100%



1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @ChPetru,

 

Your calculation is based on your data model. Please share a sample file with me and show me a screenshot with the result you want. And you can show me more details about your calculate logic. This will make it easier for us to find the solution.

 

Best Regards,
Rico Zhou

 

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

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.

Top Solution Authors