cancel
Showing results for
Did you mean:
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 / Quantity 1 2 3 4 5 6 7 8 x \$0-\$1000 \$1000-\$2000 \$2000-\$3000 Accounts Transactional Account ID Account ID1 Opportunity1 Product1 Quantity Account Value Account ID1 Opportunity2 Product2 Quantity Account ID2 Opportunity3 Product3 Quantity Account ID2 Opportunity 4 Product 1 Quantity

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

Expected Output:

 Filters: Product1 Row Total Account Value / Quantity 1 2 3 4 5 6 7 8 x \$0-\$1000 2% 0% 0% 5% 0% ... .. .. .. 100%

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.

Announcements

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

#### 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!

#### Business Application LATAM Summit 2023

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

#### 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