Forum Discussion
doubly value from distinct count with Positive Value
Hi Team,
I need your help to get the Distinc count formula. i have data of Secondary sales . I need to see the product wise distinc Outlet count who have a positive sales. In our business Day 1 we have create a invoice for outlet and day 2 we are going to deliver the product in outlet , But some outlet the Returing the Product which have order by Day 1. That means we create positive Sales at Day 1 and Negetive sales at Day 2. An example :
| Sample Data | |||
| Date | Outlet Code | Product code | Qty |
| 9/20/2018 | CT001 | 303 | 5 |
| 9/21/2018 | CT001 | 303 | -3 |
| 9/20/2018 | CT002 | 303 | 7 |
| 9/21/2018 | CT002 | 303 | -7 |
| 9/20/2018 | CT006 | 303 | 9 |
| 9/21/2018 | CT006 | 303 | -5 |
| 9/20/2018 | CT003 | 303 | 4 |
| 9/20/2018 | CT003 | 303 | 7 |
| 9/20/2018 | CT004 | 303 | 7 |
| 9/20/2018 | CT001 | 404 | 5 |
| 9/21/2018 | CT001 | 404 | -3 |
| 9/20/2018 | CT002 | 404 | 7 |
| 9/21/2018 | CT002 | 404 | -7 |
| 9/20/2018 | CT002 | 404 | 9 |
| 9/21/2018 | CT002 | 404 | -5 |
| 9/20/2018 | CT003 | 404 | 4 |
| 9/20/2018 | CT008 | 404 | 9 |
| 9/20/2018 | CT008 | 404 | -9 |
| 9/20/2018 | CT011 | 404 | -9 |
| 9/20/2018 | CT003 | 404 | 7 |
| 9/20/2018 | CT004 | 404 | 7 |
Pivot table for Getting Positive sales outlet in sheet.
| Pivot table for getting Positive sales outlet | ||
| Product Code | Outlet Code | Sum of Qty |
| 303 | CT001 | 2 |
| CT002 | 0 | |
| CT003 | 11 | |
| CT004 | 7 | |
| CT006 | 4 | |
| 404 | CT001 | 2 |
| CT002 | 4 | |
| CT003 | 11 | |
| CT004 | 7 | |
| CT008 | 0 | |
| CT011 | -9 | |
| Grand Total | 39 |
Final Expectec resutl :
| final Result | |
| Product Code | Distinc Outlet count |
| 303 | 4 |
| 404 | 4 |
Pls. find the attached link for sample file. drive Link : "https://drive.google.com/file/d/1WsgQrXXNZnqK8GgKlPGaCtuID3XPfTFM/view?usp=sharing"
Regards
Yeasin
3 Replies
- Greg_Deckler
Community Champion
The expected result of 4 for each, that is not counting the negative and 0's in your second table, correct?
In general, you would do something like:
Measure = VAR _code = MAX([Product Code]) RETURN COUNTROWS(FILTER(SUMMARIZE('Table',[Product Code],[Outlet Code],"__Qty",SUM([Qty])),[Product Code] = __code))- YarafatFrequent Visitor
Hi Greg,
Yes, You are right. I am not counting the negative and 0. Can you pls. share with me the sample PBIX file , I have already share with my data by Drive link. It will be very help full for me.
Regards,
Yeasin
- YarafatFrequent Visitor
Hi Greg,
I have tried but it's not working. Pls. find the attached file how i create the measure.
Pls. help me solved it. Here the file link: " https://drive.google.com/drive/folders/1tT_Gi_ca2Q3AJgBWzH0Ne31ISVinHS0r?usp=sharing "
Regards,
Yeasin