cancel
Showing results 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.

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

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

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors