Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

vespab24
New Contributor

SUM sales if 2 conditions exist

Hello,

I'm attempting to show records where 2017 sales <=0 AND 2016 sales >=0. The data doesn't match up to what I can see when doing the same in excel. I'm sure there is a better way to write this (super new to this). Appreciate any guidance.

My expression is as follows:

SUM(

{<

[Consolidated Partner Name]  ={"=IF(SUM({<[Year]={2017}>}[Sales USD])<=0,IF(SUM({<[Year]={2016}>}[Sales USD])>=0.01,[Sales USD]))"}

    >}

    [Sales USD])

1 Solution

Accepted Solutions
MVP
MVP

Re: SUM sales if 2 conditions exist

Try this

Sum({<[Consolidated Partner Name]  = {"=Sum({<[Year] = {2017}>} [Sales USD]) <= 0 and Sum({<[Year] = {2016}>} [Sales USD]) >= 0.01"}>} [Sales USD])

6 Replies
MVP
MVP

Re: SUM sales if 2 conditions exist

Try this

Sum({<[Consolidated Partner Name]  = {"=Sum({<[Year] = {2017}>} [Sales USD]) <= 0 and Sum({<[Year] = {2016}>} [Sales USD]) >= 0.01"}>} [Sales USD])

dwforest
Valued Contributor

Re: SUM sales if 2 conditions exist

Possibly a simple if statement?

If(Sum({<[Year] = {2017}>} [Sales USD]) <= 0 and Sum({<[Year] = {2016}>} [Sales USD]) >= 0.01, Sum([Sales USD]))

MVP
MVP

Re: SUM sales if 2 conditions exist

Is that something you are asking me David or suggesting to Bradley? You responded to my response... so was not sure

dwforest
Valued Contributor

Re: SUM sales if 2 conditions exist

Sorry, meant as a suggestion to Bradley

MVP
MVP

Re: SUM sales if 2 conditions exist

No sorry needed, just wanted to make sure that I respond if it is a question for me

vespab24
New Contributor

Re: SUM sales if 2 conditions exist

This worked perfect! I knew it was something simple and thought I tried this as well. I'm sure I had something very small in the incorrect place.

Community Browser