Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
kusha_2007
Contributor III
Contributor III

Hyphen in string value cannot be passed through a variable

Hello All, 

 

I have a value in my data which  hyphen . It is a string value like 'abc-dce'

I need to use it my set analysis and calculation to filter based on that value.

but if I pass that value , it results in the below error.

"Error: Error in set modifier ad hoc element list:
',' or ')' expected"

Below is the KPI Calculation

=num(Sum({<Region={$(vRegionView)},PeriodFlag={'YTD'}>}NET_SALES_ACT)/Sum({<Region={$(vRegionView)},PeriodFlag={'YTD'}>}NET_SALES_BUD)*100,'###.#')&'%'

vRegionView==TRIM(REGION_VIEW)

Only when I select value in Region View with the hyphen in the string , it will result in  error.

Please advise.

5 Replies
Anil_Babu_Samineni

I wonder, Where did you created the variable? Perhaps this way If you create variable in Overview?

=num(Sum({<Region={[=Region=$(vRegionView)]},PeriodFlag={'YTD'}>}NET_SALES_ACT)/Sum({<Region={[=Region=$(vRegionView)]},PeriodFlag={'YTD'}>}NET_SALES_BUD)*100,'###.#%')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
kusha_2007
Contributor III
Contributor III
Author

Hello , 
Thanks for your reply . If I changed it to below expression given by you, It just returns 0.0 for all the selections which is not correct

 

 

Anil_Babu_Samineni

What it is returning when you have applied below

=num(Sum({<Region={"=Region=TRIM(REGION_VIEW)"},PeriodFlag={'YTD'}>} (NET_SALES_ACT/NET_SALES_BUD)*100), '###.#%')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Brett_Bleess
Former Employee
Former Employee

Did Anil's latest post help you get what you needed for your use case?  If so, please do not forget to return to the thread and use the Accept as Solution button on his post that helped get things working.  This gives credit to him for the assistance as well as letting other Community Members know what actually worked.  

One other area you can search in the future to find potential assistance is the following:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

There are hundreds of how-to related posts in that area, they can be a bit tricky to find sometimes, but generally you will likely find something to help in many cases.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You will need to enclose the variable reference in single quotes:

'$(vRegionView)'

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com