Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

conditional sum based on two input box

Dear all,I have a straight table with 3 dimension (category, company and business unit) and an expression that is the daily balance.

My need is to compare the balance between two different dates.

I've created two variables and two input box date 1 and date 2.

I then used two expression for each input box like this one:

=SUM({$<DATE_REF={"$(=VAR_DATA2)"}>}Balance_CTV2)

=SUM({$<DATE_REF={"$(=VAR_DATA1)"}>}Balance_CTV2)

but the result is always "0" even the data exist.

I've laso tried without the " but always the same 0.

What is wrong in my expression?

Thank you

1 Solution

Accepted Solutions
Not applicable
Author

Hi Massimo,

excuse but today I was busy all day, and I read just now.

Please try the attached file now works for me.
I just rewrote the formulas, so it is not necessary that in the load script you create new fields.


Bye
Gennaro

View solution in original post

24 Replies
Not applicable
Author

You must convert the variables string to date try this:

=SUM({$<DATE_REF={"$(=Date(VAR_DATA2))"}>}Balance_CTV2)

=SUM({$<DATE_REF={"$(=Date(VAR_DATA1))"}>}Balance_CTV2)

Regards

Not applicable
Author

Dear Gennaro,

the variables are already defined with date format but even using your suggested sintax the result still the same

Not applicable
Author

You can send an example (qvw)  ?

Not applicable
Author

Can you please provide the definition of variables you declared. Should be an issue with your variable declaration.

Thanks,

Sai

Not applicable
Author

Dear All,

please find attached the qwv. The tab with the comparison is the last one.

Thank you for your assistance.


regards

Not applicable
Author

Looks the attachment is missing.

Not applicable
Author

Dear vsaikrishna,

Hope the qvw could answer your question. Anyway on hte input box into the number tab I've just set the format to DATE. Is the right way or there is an other point where to declare the variable?

Thank you

Not applicable
Author

I can see on the web and download. Could you just refresh?

Not applicable
Author

Please change the view of the messages in your qlik view in box in the full one in this way you will see the attachment