Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
AO1
Contributor II

SUM IF- how to write an expression to achieve SUM IF in Qlik

Hello- I have a table in Qlik Sense that I want to use as part of a bar chart. I want the chart to display 2 bars: 

1). The SUM of the Service Hours for column 'Service.Is No Show' = No (i.e. time attended)

2). The SUM of the Service Hours for column 'Service.Is No Show' = Yes (i.e. time missed)

In excel, this would be a SUM IF function. How do I write an expression in Qlik to achieve this result? 

In the snapshot below, the 2 bars would display: 

14 Hours YES

35 Hours NO

AO1_0-1730735438021.png

Everything I have tried so far just gives me the COUNT of rows with a NO, not the sum of the Service Hours with that condition. 

Any help is greatly appreciated! 

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda

@AO1  If you add [Service.Is No Show] as dimension in bar chart, and measure as sum([Sevice Hours]) would be enough to get what you want. 

View solution in original post

7 Replies
Qrishna
Master

1. SUM({$<[Service.Is No Show] = {'No'}>}[Service Hours])

2. SUM({$<[Service.Is No Show] = {'Yes'}>}[Service Hours])

Kushal_Chawda

@AO1  If you add [Service.Is No Show] as dimension in bar chart, and measure as sum([Sevice Hours]) would be enough to get what you want. 

AO1
Contributor II
Author

Thank you! I had tried a variation of that expression but kept getting an error. 

I copied what you posted over and am getting the 'error in expression'. 

Am I missing something?

AO1_0-1730736419226.png

AO1_2-1730736599527.png

 

 

 

AO1
Contributor II
Author

Thank you so much!! That worked for me! 

Qrishna
Master

what dims you have? you have to replace the fields in the expression with your original field names.

Kushal_Chawda

@AO1  Please accept the solution if that helped

AO1
Contributor II
Author

My dimension was for Program Name, which is one of my columns in the Table.