7 Replies Latest reply: Dec 27, 2016 5:06 AM by Gysbert Wassenaar

# Combine different if statements

I need to make a bar chart of the sales of a particular department and certain type of fruit and that for the previous 12 months by month.

So I want a graph with on the X axis 01-2016 , 02-2016, 03-2016 and for each month the sale of Apples for the new department.

to calculation of the sales for the department and fruit is done by:

=Sum({<Group = {New}, Fruit = {Apple} >} [Sales])

This gives me back the Sales for Apples in the new group

To present the previous 12 months in the graph I use this:

=Sum ({\$<K_Period={">=\$(=\$(vPeriodStartYear))<=\$(=Max(K_Period))"},K_Year=,K_Month=>}Sales)

This gives me all sales of all fruits and

So I want to combine both statements but everything i tried so far failed.

• ###### Re: Combine different if statements

=Sum ({\$<K_Period={">=\$(=\$(vPeriodStartYear))<=\$(=Max(K_Period))"},K_Year=,K_Month=,[Group="New"], [Fruit=[Apple]>}Sales)

• ###### Re: Combine different if statements

I'd check the result of that expression if I were you. [Group="New"] and [Fruit=[Apple] are not valid syntax. I'd be surprised if an expression containing that would return a result at all/.

• ###### Re: Combine different if statements

I used this one

Sum ({\$<K_Periode={">=\$(=\$(vPeriodeStartYear))<=\$(=Max(K_Periode))"},K_Year=,K_Month=,[Group]={"New"}, [Fruit]={"Apple"} >}_aantal_calls)

• ###### Re: Combine different if statements

That looks a lot better

• ###### Re: Combine different if statements

Is that is work for you? I don't think so

• ###### Re: Combine different if statements

=Sum ({\$<Group = {New}, Fruit = {Apple}, K_Period={">=\$(=\$(vPeriodStartYear))<=\$(=Max(K_Period))"},K_Year=,K_Month=>}Sales)

• ###### Re: Combine different if statements

It works