Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
mbjallow6
New Contributor II

qsVariable

I am trying to use the qsVariable extension in other to allow the user to input (>digits) or l(< digits) then the visualization can be sorted according to the value.

Sum({$<Fact={$(#vSum)}>}Fact)

i use the syntax above to create an app. however, it doesnot recognize the following symbols (< >)

thank you.

4 Solutions

Accepted Solutions

Re: qsVariable

I don't get why are you using # in your variable

all what you need to do is have expression like:

Sum({$<Fact={"$(vSum)"}>}Fact)

where vSum is your variable input and it can be ">100" or <45 or whatever....

cheers Lech, 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 to the problem.

View solution in original post

Re: qsVariable

Ok,

My expression is correct. What you have done is you have copied and pasted the exact expression from my post where "" marks were changed to some other characters (note difference between "" and “”)

So once again use this formula from below and it will work!

Sum({<Dim = {"=Sum(Fact)$(vSum)"}>} Fact)

cheers Lech, 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 to the problem.

View solution in original post

Re: qsVariable

I also would add anther variable which would control sign just to avoid any issues with syntax...

Attached is my sample app.

Hope this helps

1.png

cheers Lech, 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 to the problem.

View solution in original post

Re: qsVariable

Hi,

you need to create another variable as your condition cannot exist in single variable... and embed it in your extended expression.

 

Expression will look like this (note * union character between sets):

Sum({<Dim = {"=Sum(Fact)>$(vSum)"}*{"=Sum(Fact)<$(vSum2)"}>} Fact)

or when using additional variable for <= sign.....

Sum({<Dim = {"=Sum(Fact)$(vSign)$(vSum)"}*{"=Sum(Fact)$(vSign2)$(vSum2)"}>} Fact)

 

Regarding your "Last 12 Months" question there are multiple ways of achieving the same:

  • Users need to apply selections direcly in Qlik Sense
  • You can harcode Last 12 months in set analysis expression (given that you have properly loaded and formatted date field) like this: Sum({<Date={">=$(=AddMonths(Today()-12))<=$(=Today())"},Dim = {"=Sum(Fact)$(vSign)$(vSum)"}*{"=Sum(Fact)$(vSign2)$(vSum2)"}>} Fact)
  •  You can create Last 12 months flag in script calendar and use flag as selection or in set analysis

1.png

Regarding your "Last 12 Months" question....This was very basic question you asked and I really suggest you learn little bit of Qlik Sense first before asking them (go through help.qlik.com (text and videos), go through blogs etc.. or even get a basic 5 day training from Qlik Partner or Qlik) .

I do not want to be harsh but i think there needs to be a minimum level of knowledge when we discuss things here.

Attached is document with all options implemented!

cheers Lech, 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 to the problem.

View solution in original post

16 Replies
Partner
Partner

Re: qsVariable

Hi Mbjallow,

I'm having some troubles with your problem. To start, what do you want to achieve? Like, what kind of object are you making?

Jordy

Climber

Work smarter, not harder
mbjallow6
New Contributor II

Re: qsVariable

hello Jordy 

okay let me explain with examples.

i am creating a on time delivery dashboard.

i want the user be able visualize the chat according to the total amount of money spent on each supplier.

therefore i want to create a qsvariable filter where the user can input as follow: (>1000) and will show all suppliers who's transaction is above 1000 USD. or (<1000) and will show all suppliers who's transaction is less than 1000 USD.

as of now i am using a syntax like this "Sum({$<Fact={$(#vSum)}>}Fact)" but with this it can only show suppliers with exactly the amount the user have inputted.

i hope i have explained it better this time around if you still need more details i can share with you.

 

Re: qsVariable

I don't get why are you using # in your variable

all what you need to do is have expression like:

Sum({$<Fact={"$(vSum)"}>}Fact)

where vSum is your variable input and it can be ">100" or <45 or whatever....

cheers Lech, 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 to the problem.

View solution in original post

Highlighted
mbjallow6
New Contributor II

Re: qsVariable

the problem of "<" and ">" has been solve but still have issues with the data. to better explain the problem, i will attached a few screenshots

Screenshot (84).pngRaw Data

 

Screenshot (85).pngAggregated data (Sum)

 

Screenshot (88).png< 100

 

Screenshot (89).png>100

 

its like the sum function is not executed. 

for example when the user input (< 100) i expect to see only the I dimension to show on the chart because from the sum table it is the only dimension with less that 100.

Thank you in advance.

Re: qsVariable

I see,

 

So this is completly different requirement to what you have descibed as you are not trying to filter Fact field and instead you are trying to filter Dim field based on aggregated expression!!!

In such case your Set Analysis will look completly different and it will be something like this:

Sum({<Dim = {“=Sum(Fact)$(vSum)”}>} Fact)

cheers Lech, 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 to the problem.
mbjallow6
New Contributor II

Re: qsVariable

Screenshot (90).png

I have try this set expression: Sum({<Dim = {“=Sum(Fact)$(vSum)”}>} Fact) 

but the result is as the screenshot above. 

i want to know why do you have to equate the Dim field to the sum of Fact field and the variable?

the Dim field is not numeric and the variable is just equal to the fact field.

I sure that i kinda sound awkward but please be patient with me. I am new here.

Thank you for your time.

Re: qsVariable

This is more advanced set analysis syntax and it preaty much means:

show me all Dim's where Sum(Fact) is greater or less Than your variable.

 

cheers Lech, 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 to the problem.

Re: qsVariable

i will build POC and test results.. and will get back to you again in few hours...

cheers Lech, 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 to the problem.
mbjallow6
New Contributor II

Re: qsVariable

exactly what i wanted to mention. "show me all Dim's where Sum(Fact) is greater or less Than your variable."

I will wait for your update. 

thank you for the clear and concise  insight.