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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kavitha_kommise
Partner - Contributor III
Partner - Contributor III

Based on input values expression

Hello ,

i have a requirement like user will give value and year based on those values i need to calculate condition like in that particular year if the sum(filed) is <=that user input value then i have to show sum(field) else 0.now i want to know how this can be achieved,

till now i have tried like i created two variables and added in input box  now user can able to give values.using that variables how to built expression.please help on same .i am new to qlik view.

thanks in advance

kavitha

6 Replies
vishsaggi
Champion III
Champion III

May be this?

= Sum(If(Year = vYear and Field <= vValue, Field, 0))

kavitha_kommise
Partner - Contributor III
Partner - Contributor III
Author

i have used below expression.finally got the solution.

=if(sum({<YEAR={$(Vdate)}>[field])<=vvar,

sum({<YEAR={$(Vdate)}>}[field),0)

thanks for help

thanks and regards

kavitha.

vishsaggi
Champion III
Champion III

OK can you close the thread marking yours correct and any helpful responses.

kavitha_kommise
Partner - Contributor III
Partner - Contributor III
Author

hello,

user requirement has changed and that is i have a drill down year and month and then date.

so now user will give a input value. if  filed is lesser than 0r equal to a input value then it has to show sum(field) and if it is a greater than it has to show till equal to a input field after coming months sum has to show as 0.

how can i achieve this please help on same.

thanks and regards,

kavitha

vishsaggi
Champion III
Champion III

Can you share some sample data and with your expected output?

kavitha_kommise
Partner - Contributor III
Partner - Contributor III
Author

i have a sample data like

field         date

12000      01-01-2018

20000      01-02-2018

15000      01-03-2018

10000      01-04-2018

10000      01-01-2017

12000      01-01-2017

20000      01-02-2017

15000      01-03-2017

i have drill down for year ,month,and then date

now,

if user input value(IP)=40000

then it has to show nearest value of 40000 after coming months it has to show 0

for this sample data

for 2018 --sum(filed)=57000

   2017---57000

if user selection is 40000

then it has to show for year drill down 40,000 and month drill down it has to show till march then coming months zero.like that based on input value it has to work like that.

user will give year and some input value will give based on that it has to work.

if user input value(IP) is greater than sum(field) then below condition will satisfy.

=if(sum({<YEAR={$(Vdate)}>}[field])<=vvar,

num(sum({<YEAR={$(Vdate)}>}[field]),'###,##.##'),0.0)

for above senario what can be achieved please help on same.

thanks in advance,

kavitha