9 Replies Latest reply: May 17, 2010 5:42 PM by Dinesh Thoniparambil

# 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.

• ###### Conditional Sum

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.

• ###### Conditional Sum

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

• ###### Conditional Sum

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.

• ###### Conditional Sum

Do you mean to put it above the chart?

• ###### Conditional Sum

Did you want it like this:

• ###### Conditional Sum

Did you forget any attachment?

• ###### Conditional Sum

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)

• ###### Conditional Sum

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!!!

• ###### Conditional Sum

yes above the chart