Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Miguel_Angel_Baeyens

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
Miguel_Angel_Baeyens

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
Author

Hi Anykay,

You can use this expresion

Sum

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

I hope to help you.





Not applicable
Author

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?

Miguel_Angel_Baeyens

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.

Not applicable
Author

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
Author

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
Author

i solved it myself 😃

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

of course.. 😃

//A.