Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
Anonymous
Not 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   
CodeUnits  
AP500028621051  
AP50002862105-1  
AP520011608993  
BI800001609436  
    
I have to count at Code level if units>0 
    
CodeUnitsfinal output 
AP5000286210500 
AP5200116089931 
BI8000016094361 
  2 

Please suggest. Thanks a lots.

@Tanushree_Kapse @amitchandak @Greg 

1 ACCEPTED SOLUTION

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])
 
Tanushree_Kapse_1-1630648767195.png
Mark this as a solution, if I answered your question. Kudos are always appreciated.
Thanks.

View solution in original post

6 REPLIES 6
Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

Please find the Screenshot:

Tanushree_Kapse_0-1630595850872.png

Tanushree_Kapse_1-1630596025237.png

 

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.

 

Anonymous
Not 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

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])
 
Tanushree_Kapse_1-1630648767195.png
Mark this as a solution, if I answered your question. Kudos are always appreciated.
Thanks.
Anonymous
Not applicable

Thanks a lot Tanu,

You are super excellent. Salut you. Thank you so much for such a great support.

Always a pleasure!😊

Anonymous
Not applicable

Now I got what I was looking for. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors