Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Not applicable

set analysis calculation based on selection

Hi,

The end user wants to select a date and then count sales based on calculations around that date.

e.g. use selects a date, the user wants to see sales for the dates before the selected date.

I'm thinking a set analysis of course but i don't know how to write it when it comes to the date to be calculated around.

This is roughly expressed of how i want to do, script-wise;

=sum({$<InvoiceActivationDate={date(InvoiceActivationDate)-15}>} OriginalPrice)

Thanks in advance

//A.

1 Solution

Accepted Solutions

SV:Re: set analysis calculation based on selection

Yes, you can set it in the script, but it will be modified in runtime, you can create it either in the Settings menu, Variable Overview. But the valur of the variable is... variable. I mentioned minimum and maximum values set in the Slider/Calendar object.

Take a look at this file, it's very similar to what you want to get.

Hope that helps.

View solution in original post

7 Replies

set analysis calculation based on selection

Hello,

I'd use a variable vDateFrom, used in a calendar object, where the minimum date is set to

=Min(InvoiceActivationDate)


and likewise with the maximum using Max() instead. To be shown as dates, go to the "Number" tab in the Object Properties, and set it to "Date".

Then use the following expression in your chart

Sum({< InvoiceActivationDate = {'>=$(=Date(vDateFrom -15))<=$(=Date(vDateFrom))'} >} OriginalPrice)


Make sure that InvoiceActivationDate and the result of vDateFrom are formatted the same.

Hope that helps.

Not applicable

set analysis calculation based on selection

Hi Anykay,

You can use this expresion

Sum

({$<[Fecha de la transacción]={"<$(InvoiceActivationDate)"}>} OrigalPrice)

I hope to help you.





Not applicable

SV:Re: set analysis calculation based on selection

Ok.. About the variable, do i set this in the script? because i tried let vDateFrom=min(InvoiceActivationDate)

But that didn't work out.

And in the calender object i'm lost...

Sorry... where do i go wrong?

SV:Re: set analysis calculation based on selection

Yes, you can set it in the script, but it will be modified in runtime, you can create it either in the Settings menu, Variable Overview. But the valur of the variable is... variable. I mentioned minimum and maximum values set in the Slider/Calendar object.

Take a look at this file, it's very similar to what you want to get.

Hope that helps.

View solution in original post

Not applicable

SV:Re: SV:Re: set analysis calculation based on selection

Great document! I will get a lot of hlep from that one! Thanks!

I think this will solve my problem! Otherwise i might get back to you 😃

Thanks again!

//A.

Not applicable

SV:Re: SV:Re: set analysis calculation based on selection

I have another problem that i think can be solved.

When i've selected i few invoices the selection of vStartDate narrows down so that i i only can choose between the invoices first and last transaction dates. I want to be able to chose any date i want despite what i've chosen before.

Is it possible?

Thanks in advance!

//A.

Not applicable

SV:Re: SV:Re: set analysis calculation based on selection

i solved it myself 😃

i wrote min({1} transaction_date) instead of min(transaction_date)

of course.. 😃

//A.