Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
lweny
Contributor
Contributor

Function in Function in Qlik Sense

Hi all, I have small problem here with Qlik Sense since I'm really new to it. I'm going to count the total sales based on two fields, and I've written a script as below: =sum({$<[A]={"A2"}, mid([B],5)={"B2"}>}[Total_sales]) but it gives me error. Could you please point out the mistakes and make some corrections? Thanks.
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

The left hand side of a set expression criterion must be a field name, not an expression, so this does not work:

=sum({$<[A]={"A2"}, mid([B],5)={"B2"}>}[Total_sales])

You can probably use this to achieve what I think you were trying:

=sum({$<A = {"A2"}, B = {"*B2*"}>} Total_sales)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
Vegar
MVP
MVP

It is the mid([B],5)={"B2"} that is your problem. You can only modify fields not expressions. You can look at set modifiers as invisible selections in your data model.

 
Try to rephrase your modifier so that you have [B] = {something}
jonathandienst
Partner - Champion III
Partner - Champion III

The left hand side of a set expression criterion must be a field name, not an expression, so this does not work:

=sum({$<[A]={"A2"}, mid([B],5)={"B2"}>}[Total_sales])

You can probably use this to achieve what I think you were trying:

=sum({$<A = {"A2"}, B = {"*B2*"}>} Total_sales)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
lweny
Contributor
Contributor
Author

Hi jonty, thanks for replying. It works! Cool! Thanks very much