cancel
Showing results for 
Search instead for 
Did you mean: 
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
RicoZhou
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
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors