Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
lweny
Contributor II
Contributor II

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 II
Contributor II
Author

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