Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Vladimir_NBG
Helper I
Helper I

Numeric distribution - How to create measure

Hi All,

I would need help in calculating numeric distribution, in terms how to exactly set up a formula.

So, in the table below there is "dummy" numbers.

I need formula that will distinct count only those stores where certain product has positive quantity on total.

Pay attention on PRODUCT A, and STORE CODE 1.

 

PRODUCT NAMESTORE CODESALES QUANTITY
PRODUCT A138
PRODUCT B167
PRODUCT C122
PRODUCT A225
PRODUCT A1-39
PRODUCT C234
PRODUCT B325
PRODUCT A438

 

This is the result i would like to get through formula (i put explanation column only for additional clarification):

 

PRODUCTDISTRIBUTION (NUMBER OF STORES)EXPLANATION         
PRODUCT A2STORE CODES 2 & 4   ---> STORE 1 IS NOT COUNTED BECAUSE THE TOTAL QUANTITY FOR THIS PRODUCT IS -1
PRODUCT B2STORE CODES 1 & 3         
PRODUCT C2STORE CODES 1 & 2         
            

 

Thank you very much in advance!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @Vladimir_NBG 

Please check the below picture and the sample pbix file's link down below.

 

Picture4.png

 

Distribution (Number of stores) =
IF (
ISFILTERED ( 'Table'[PRODUCT NAME] ),
COUNTROWS (
FILTER (
VALUES ( 'Table'[STORE CODE] ),
CALCULATE ( SUM ( 'Table'[SALES QUANTITY] ) ) > 0
)
)
)

 

 

https://www.dropbox.com/s/9tebnnhih3fsikd/vladimir.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @Vladimir_NBG 

Please check the below picture and the sample pbix file's link down below.

 

Picture4.png

 

Distribution (Number of stores) =
IF (
ISFILTERED ( 'Table'[PRODUCT NAME] ),
COUNTROWS (
FILTER (
VALUES ( 'Table'[STORE CODE] ),
CALCULATE ( SUM ( 'Table'[SALES QUANTITY] ) ) > 0
)
)
)

 

 

https://www.dropbox.com/s/9tebnnhih3fsikd/vladimir.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you Jihvan! I applied it on my data and it works.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.