Forum Discussion
Anonymous
5 years agoNot applicable
How to count it units>0
Hi guys,
Data is stored in below formats but I have to count at summary 2 level if units>0.
| Raw data | |||
| Code | Units | ||
| AP50002862105 | 1 | ||
| AP50002862105 | -1 | ||
| AP52001160899 | 3 | ||
| BI80000160943 | 6 | ||
| I have to count at Code level if units>0 | |||
| Code | Units | final output | |
| AP50002862105 | 0 | 0 | |
| AP52001160899 | 3 | 1 | |
| BI80000160943 | 6 | 1 | |
| 2 |
Please suggest. Thanks a lots.
Hi Anonymous ,
Use these measures:
First calculate the count:Count = Var a= CALCULATE(SUM('Table (3)'[Units]))return IF(a>0, COUNT('Table (3)'[Code]),0)second To get the correct total:Fix = SUMX(VALUES('Table (3)'[Code]),[Count])Mark this as a solution, if I answered your question. Kudos are always appreciated.Thanks.
6 Replies
- Tanushree_KapseImpactful Individual
Hi Anonymous ,
Please find the Screenshot:
Count = VAR a= CALCULATE(COUNT('Table (3)'[Units]),'Table (3)'[Units]> 1)return IF(a=BLANK(),0,a)Mark this as a solution, if I answered your question. Kudos are always appreciated.Thanks.- AnonymousNot applicable
Thanks for reply.
I have to count >0 units not >1 units.
I have applied the logic already as you mentioned but when I check at code level it is counting where units is 0 as well . like in table 2. first code having units 0 idealy count should not happen at that row.
please check
- Tanushree_KapseImpactful Individual
Hi Anonymous ,
Use these measures:
First calculate the count:Count = Var a= CALCULATE(SUM('Table (3)'[Units]))return IF(a>0, COUNT('Table (3)'[Code]),0)second To get the correct total:Fix = SUMX(VALUES('Table (3)'[Code]),[Count])Mark this as a solution, if I answered your question. Kudos are always appreciated.Thanks.