Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hammermill21
Creator III
Creator III

Using Count Function

Hello,

 

I am trying to count all the barcode number that have an xtype of Eyewash Stations and a retired barcode marked as yes. For some reason I can't get it to work:

Count({< xtype = {'Eyewash Station'}, retired_barcode = {"yes"}>} [building])

 

And this is my data:

 

 

Labels (1)
7 Replies
dplr-rn
Partner - Master III
Partner - Master III

Code looks right. I am guessing there is more to your requirement.

Are you trying to get a count of buildings or barcode ? you code is a count of buildings.

What do you mean by "not working".

please explain in more detail

hammermill21
Creator III
Creator III
Author

I had building because I was testing it, but I tried to count by barcode also. I am getting zero count when there you should 1 as a total.  

 

Really what I need to do is count the inventory items that are Eyewash Stations - the inventory that is eyewash station & retired barcode numbers.  I counted the inventory excluding the filters week & weekday by using this expression:

Count( {< Week= , WeekDay= , xtype = {'Eyewash Station'} >} barcode_number )

Then I tried to add this to it:

Count( {< Week= , WeekDay= , xtype = {'Eyewash Station'} >} barcode_number )
-
Count({< xtype = {'Eyewash Station'}, retired_barcode = {"yes"}>} [barcode_number])

 

And it is giving me a zero count.

sasiparupudi1
Master III
Master III

May be you need aggr function here

 

Try

Sum(Aggr(

Count({< xtype = {'Eyewash Station'}, retired_barcode = {"yes"}>} [barcode_number])

,Building)

)

hammermill21
Creator III
Creator III
Author

Hi thank you, but that just gives me a count of zero each time. 

sasiparupudi1
Master III
Master III

Please post a sample app

hammermill21
Creator III
Creator III
Author

I have attached it to my original post. It is under Eyewash stations, inventory. 

 

Thank you!

sasiparupudi1
Master III
Master III

Hi 

When I exported the data to excel and checked, I get 6 records for eyewash and retired _barcode

Eyewash Stationyes400933_R
Eyewash Stationyes400982_R
Eyewash Stationyes400994_R
Eyewash Stationyes401156_R
Eyewash Stationyes403704_R
Eyewash Stationyes406829_R

 

If you count all Eyewash Stations, you get 568 so your KPI is showing he correct value.. Am I missing something here?