Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

kpapanik
New Contributor III

Sum If Condition

Hello all!!!

I need help,  i have the above expression but it doesn't work...

if(YEAR='2016' and Store='FO Type 5', sum(TOTAL PARTPATT='5 ΕΜΠΟΡΕΥΜΑΤΑ FO'[Net Sales]))

All the green fields are dimensions.

I want to make that calculation..

if year =2016 and store=FO Type 5 then calculate the Total sum of Net Sales but for a different dimension wich is PARTPATT=5 ΕΜΠΟΡΕΥΜΑΤΑ FO

Thank you very much in advance!

Kyparisia

1 Solution

Accepted Solutions
kpapanik
New Contributor III

Re: Sum If Condition

Super it works.. but i have to choose the Year 2016 from my listbox in order to work!

Any idea how i can avoid this?

5 Replies
lironbaram
Honored Contributor II

Re: Sum If Condition

hi

try this

if(YEAR='2016' and Store='FO Type 5', sum(TOTAL if(PARTPATT='5 ΕΜΠΟΡΕΥΜΑΤΑ FO',[Net Sales])))


kpapanik
New Contributor III

Re: Sum If Condition

Super it works.. but i have to choose the Year 2016 from my listbox in order to work!

Any idea how i can avoid this?

rahulpawarb
Valued Contributor II

Re: Sum If Condition

Hello Kyparisia,

In this case you have to use Set Analysis. I have created a sample expression as given below (You need to further modify it, if required).

Sum({<YEAR={'2016'}, Store={'FO Type 5'}, PARTPATT={'5 ΕΜΠΟΡΕΥΜΑΤΑ FO'}>}TOTAL [Net Sales])

Hope this will be helpful.

Regards!

Rahul

kpapanik
New Contributor III

Re: Sum If Condition

Hello Rahul,

It doesn't work because the dimension Store={'FO Type 5'} doesn't have Net Sales for PARTPATt={'5 ΕΜΠΟΡΕΥΜΑΤΑ FO'} it has only Net sales for {'1 ΕΜΠΟΡΕΥΜΑΤΑ FO'}

but i want in this line were the 'FO Type 5' is, to show the Total  Net Sales of {'5 ΕΜΠΟΡΕΥΜΑΤΑ FO'}

I know it's a bit confusing, but i have to show it this way! Plz tell me if you have anything in your mind that might help.

Thank you so much...

rahulpawarb
Valued Contributor II

Re: Sum If Condition

Hello Kyparisia,

Thank you for sharing your inputs.

For accurate feedback could you please share application with sample data?

Regards!

Rahul