# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New 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
MVP

## Re: Function in Function in Qlik Sense

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
3 Replies
Partner

## Re: Function in Function in Qlik Sense

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}
Plees ekskuse my Swenglish and or Norweglish spelling misstakes
MVP

## Re: Function in Function in Qlik Sense

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
Highlighted
New Contributor

## Re: Function in Function in Qlik Sense

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