Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum for conditional use of formula in graph

Hi All,

I would like to sum values calculated by different formulas, which depends on the particular field value, somethink like:

if (LArt='LDUB15',0,
     
if(LEFT(LArt,4)='LDUB',sum(Price*Volume/1000),
          
sum(Volume*Price*100)))

See attached example QVW

if I use it in pivot table with more dimensions, it works fine BUT if I Use it in Graph with one Dimenson (Group), it uses only the last formula (sum(Volume*Price*100) ) for every row and kumulate it. I cant use additional dimension.

The right sum Value for dimension Group in Graph is 11 200,070 (NOT 18 200)

Does somebody has an idea how to sole it.

thanks a lot for your Idea(s)

Robert

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try this

=sum(if(LArt='LDUB15',0,          if(LEFT(LArt,4)='LDUB',Price*Volume/1000,                    Volume*Price*100)))

i.e. embedding the condition into the sum, not the sum into the condition.

View solution in original post

2 Replies
swuehl
MVP
MVP

Try this

=sum(if(LArt='LDUB15',0,          if(LEFT(LArt,4)='LDUB',Price*Volume/1000,                    Volume*Price*100)))

i.e. embedding the condition into the sum, not the sum into the condition.

Not applicable
Author

Hi Swuehl,

thanks for help.

I have tried to use this logic before, even more times, but allways got the "Error in expression". Originaly I have more IFs in expression then in my example, therfore migt be I have forgotten to delete something...

Thanks again.

Robert