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: 
tobiasaechter
Contributor III
Contributor III

if certain value is selected in field then show volume

Hi I am trying to achieve the following:

I have a field with multiple values. Fieldname: A; Field values x,y,z, xx, yy, zz

Additionally I have one field with volumes and one field with special volumes.

 

Now I want to write an expression that shows volumes or special volumes depending on the selection of the field values.

My expression is:

If(A <>'x*', sum(volumes)) -> this shows me the volume for all field values except x and xx.

Additionally I want to show now special volumes when selecting x or xx. So I tried the following:

 if(wildmatch(A, '*x*'),sum([special volumes]))  -> this works as individual expression, but combining both expressions does not work. 

 

If(A <>'x*', sum(volumes),

if(wildmatch(A, '*x*'),sum([special volumes])).

This combined expression only provides results for the first if statement but when selecting x or xx it does not show any values anymore.

 

Can anyone help me out here how to correct my expression?

 

Labels (2)
1 Reply
Dalton_Ruer
Support
Support

Not exactly sure of the problem with what your formula is. Only thing I do notice is that your first formula is "starts with X" and your wildmatch has X anywhere in it. If you are simply trying to sum volumes field if the value is X* or special volumes if it isn't can't you just use:

If(A <>'x*', sum(volumes), sum([special volumes])

Not sure how elaborate, or frequent, your real use case is, but this is the type of thing I like to handle in the load script so that the user interface isn't slowed down doing calculations that are not dependent on other field values or selections.