Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 NAME | STORE CODE | SALES QUANTITY |
PRODUCT A | 1 | 38 |
PRODUCT B | 1 | 67 |
PRODUCT C | 1 | 22 |
PRODUCT A | 2 | 25 |
PRODUCT A | 1 | -39 |
PRODUCT C | 2 | 34 |
PRODUCT B | 3 | 25 |
PRODUCT A | 4 | 38 |
This is the result i would like to get through formula (i put explanation column only for additional clarification):
PRODUCT | DISTRIBUTION (NUMBER OF STORES) | EXPLANATION | |||||||||
PRODUCT A | 2 | STORE CODES 2 & 4 ---> STORE 1 IS NOT COUNTED BECAUSE THE TOTAL QUANTITY FOR THIS PRODUCT IS -1 | |||||||||
PRODUCT B | 2 | STORE CODES 1 & 3 | |||||||||
PRODUCT C | 2 | STORE CODES 1 & 2 | |||||||||
Thank you very much in advance!
Solved! Go to Solution.
Hi, @Vladimir_NBG
Please check the below picture and the sample pbix file's link down below.
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
Hi, @Vladimir_NBG
Please check the below picture and the sample pbix file's link down below.
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
Thank you Jihvan! I applied it on my data and it works.
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
11 | |
9 | |
6 |