Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Conditional Sum

I have 2 columns. Year (Dimension) & Flag (Y/N). I want to show a line graph with year as dimension & 2 lines (count of all Y & count of all N). How can I create a new measure which is essentially a conditional SUM. Something along with this line: SUM(if flag = 'Y' then 1 else 0) or count(*) where flag = 'Y'.

Thanks.

Dinesh.

1 Solution

Accepted Solutions
boorgura
Specialist
Specialist

2 Expressions:

Count(if(Flag = 'Y', 1))

Count(if(Flag = 'N', 1))

And Year as the dimension.

Let me know if it works or not.

View solution in original post

9 Replies
boorgura
Specialist
Specialist

2 Expressions:

Count(if(Flag = 'Y', 1))

Count(if(Flag = 'N', 1))

And Year as the dimension.

Let me know if it works or not.

Not applicable
Author

The best option for you is to use Set Analysis.

Write something to the effect of:

COUNT({$<{flag = {Y}> flag}

and

COUNT({$<{flag = {N}> flag}

Hope this helps,

Peter

Anonymous
Not applicable
Author

How do I adjust the horizontal setting of the placement of the legend? All I see is the vertical alignment. I want to place the legend at top center & cannot find an option.

Thanks,

Dinesh.

boorgura
Specialist
Specialist

Do you mean to put it above the chart?

boorgura
Specialist
Specialist

Did you want it like this:

Anonymous
Not applicable
Author

yes above the chart

Anonymous
Not applicable
Author

Did you forget any attachment?

boorgura
Specialist
Specialist

Oops... my bad.

I thought i pasted it.

Not sure, if you can see the picture.

But one way to get the legend on the top is:

with the control on the chart, press and hold Ctrl + Shift ... you will get the choice to move around things within the chart. Like resizing LEGENDs moving them around. Moving the Text in Chart pieces.

But, not an easy one though. if something gets screwed - feel free to Reset them on the properties (Reset user sizing and Reset User Docking)

Anonymous
Not applicable
Author

Thanks. Appreciate it. Did not get the exact results I was looking for (was looking for side by side, but came top to bottom). But got pretty close!!!