Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Easy Sum with Variable Question

As part of this trying to convert an end user entered Date (on a calendar element) inside the expression, in a normal "If" statement it works fine as Date(vDateEntered) to converts successfully from number to date format. 

Sample:    =Sum(If(SalesDate=Date(vDateEntered), Sales)) works perfectly.

But converting this example to set analysis isn't converting to date mm/dd/yyyy format correctly.

=sum({<SalesDate={'=Date$(vDateEntered)}>} Sales) 

(just summing up sales for whatever date a person picked)

Can you tell me the right syntax for this?   Thanks much!

1 Solution

Accepted Solutions
Not applicable

Re: Easy Sum with Variable Question

Set analysis can be applied only on the field and hence its essencial to apply the format of the conditional expression to be same as the the field format. You can modify the expression to:

sum({<SalesDate={"=TimeStamp$(vDateEntered)"}>} Sales)

if it not works try

sum({<SalesDate={"=Text(TimeStamp$(vDateEntered))"}>} Sales)

Idea is to match expression return type to the field format. Try around with the expression and nplay around with the formats to match the return to the field. You can check the return by tryin the set expression in a text box.

Regards,

Kiran Rokkam.

4 Replies
Not applicable

Re: Easy Sum with Variable Question

=sum({<SalesDate={"$(=Date(vDateEntered))"}>} Sales)

Kiran Rokkam.

Not applicable

Re: Easy Sum with Variable Question

Thats perfect, one new issue, SalesDate is stored in the format 1/31/2011 12:00:00 AM, so i need to use Date(SalesDate) to convert it to 1/31/2011.

How can i get that SalesDate conversion into your syntax?

Thanks again very much!

Not applicable

Re: Easy Sum with Variable Question

Set analysis can be applied only on the field and hence its essencial to apply the format of the conditional expression to be same as the the field format. You can modify the expression to:

sum({<SalesDate={"=TimeStamp$(vDateEntered)"}>} Sales)

if it not works try

sum({<SalesDate={"=Text(TimeStamp$(vDateEntered))"}>} Sales)

Idea is to match expression return type to the field format. Try around with the expression and nplay around with the formats to match the return to the field. You can check the return by tryin the set expression in a text box.

Regards,

Kiran Rokkam.

Not applicable

Re: Easy Sum with Variable Question

Thank you very much!