Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan0211
Creator
Creator

Variable with the { included

I have a variable like this:

{<[Total Value]={">1000000"}>}

I am then taking that variable and using it to calculate a KPI like this:

=Count({<[Category]={'Auto'}> * $($(vFilter))}[SA Title])

The KPI should count all of the Auto columns with a total cost over 1000000.

When I get the expression back, it comes in like this:


=Count({<[Category]=['Auto']> * {<[Total Value]={">1000000"}>}}[Title])

The {...} around the <[Total Value] section is throwing errors.  I have the {} in there because this also filters a table and that works correctly.  Is there a way to remove the {} from the variable when I do the count for the KPI?

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

You're right, that will not get after first }.  try this instead:

 

$(=right(left('$(vFilter)', len('$(vFilter)') - 1), len('$(vFilter)') - 2))

 

=Count({<[Category]={'Auto'}> * $(=right(left('$(vFilter)', len('$(vFilter)') - 1), len('$(vFilter)') - 2)) }[SA Title])

View solution in original post

6 Replies
stevejoyce
Specialist II
Specialist II

$(=textbetween('$(vFilter)','{', '}',1))

 

=Count({<[Category]={'Auto'}> * $(=textbetween('$(vFilter)','{', '}',1)) }[SA Title])

Evan0211
Creator
Creator
Author

Unfortunately, that expresses to:

=Count({<[Category]=['Auto']> * - }[Title])

and says there is an error in the expression: '}' expected

stevejoyce
Specialist II
Specialist II

You're right, that will not get after first }.  try this instead:

 

$(=right(left('$(vFilter)', len('$(vFilter)') - 1), len('$(vFilter)') - 2))

 

=Count({<[Category]={'Auto'}> * $(=right(left('$(vFilter)', len('$(vFilter)') - 1), len('$(vFilter)') - 2)) }[SA Title])

Evan0211
Creator
Creator
Author

That did the trick thank you so much!

stevejoyce
Specialist II
Specialist II

Great.  please mark correct solution so thread can be closed.

Digvijay_Singh

May be this works as well, not sure - 

=Count({<[Category]={'Auto'}> * $(=replace('$(vFilter)','{<','<'))[SA Title])