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: 
Anonymous
Not applicable

Set Analysis

Hey There,

i try to use function on set analysis but i see i have an errors in my expression.

need some help

This is not working 

=Sum({<Left(OrderDateKey,4)={'2006'}>}SalesAmount)

This is work :

Sum({$<Year={"$(=Year(Today()))"}>}Sales)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

But you can do a search on your field values like

=Sum( {<OrderDateKey={"2006*"} >} SalesAmount)

edit:

This should also work, just for demonstration:

=Sum( OrderDateKey={"=Left(OrderDateKey,4)=2006"}>}SalesAmount)

View solution in original post

6 Replies
sunny_talwar

You are not allowed to use functions on the left hand side of the set analysis modifier and that is why the first expression isn't working.

jepeerik
Contributor III
Contributor III

You can only compare fields (in your case Year) with values within Set Analysis.

So if you convert OrderDateKey in your script into a Year field, you'll be able to create the second proposed Set Analysis.

And for performance reasons it is also better to prepare your dimensions in the script instead of having a calculated dimension in your front-end of the dashboard.

Sharing knowledge increases your knowledge
maxgro
MVP
MVP

1st expression:

one solution could be to add a year field in the script (maybe in a calendar),

then use this new field in set analysis

swuehl
MVP
MVP

But you can do a search on your field values like

=Sum( {<OrderDateKey={"2006*"} >} SalesAmount)

edit:

This should also work, just for demonstration:

=Sum( OrderDateKey={"=Left(OrderDateKey,4)=2006"}>}SalesAmount)

Anonymous
Not applicable
Author

Thank you but the second expression not working for me. i think the best way to do it is on the script

Anonymous
Not applicable
Author

I think about it as solution wanna be sure that is not possible Thx