Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Asuod_
Creator
Creator

Sum by Dimension If multiple Count statements

Hello,

New to Qlik sense.

I have the following IF statement  but im trying to bucket it by a dimension and SUM the count to put it into a KPI. Ive been trying the Sum(aggr( functions but have had no luck. Thank you in advance.

if(Count([Logs.RobotName]) > 0 and count([Logs.AutomationName])>0 and count([Logs.MachineId]) > 0 and [Licenses.IsDeleted] = 0, 1, 0 )

Labels (3)
3 Replies
Angela_Zhou
Contributor III
Contributor III

It's hard to tell you an working answer without sample data and expected outcome. Assume you want following biz logic in KPI,
   Sum(  Total sum of your if-else count by dimensions  )

Then you can try below:
SUM(
Aggr(
   SUM(
   if(Count([Logs.RobotName]) > 0
     and count([Logs.AutomationName])>0
     and count([Logs.MachineId]) > 0
     and [Licenses.IsDeleted] = 0
   , 1, 0)
   )
, dim01, dim02)
)

Angela Z.
Asuod_
Creator
Creator
Author

Hi Angela, 

I added a screenshot of the data, the If else statement I put in populates the Active column and essentially i would like to be able to SUM the Active column into a KPI. So out of the 38 rows, 30 are considered active and show that 30 in a KPI. 

Asuod__0-1653516769555.jpeg

 

Asuod_
Creator
Creator
Author

I was able to solve my issue, i appreciate the help.

Sum(

{$<[Licenses.IsDeleted] = {'0'}>}

Aggr(

   if(Count([Logs.RobotName]) > 0

     and count([Logs.AutomationName])>0

     and count([Logs.MachineId]) > 0

   , 1, 0)

, Dim))