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: 
Anonymous
Not applicable

Set Analysis Expression with Dates

Hi everybody,


I need to convert this expression to an instruction set analysis, considering that DiasFin and DiasIni are fields in the associative model and dimensions in the table where I'm adding this expression. Usually I specified in Set Analysis the value or used a variable, but in this case neither method throws me the value I need.

 

if(FechaDocumento >= Date(today() - num(DiasFin) , 'DD/MM/YYYY') and FechaDocumento <= Date(today() - num(DiasIni) , 'DD/MM/YYYY')

Thanks you!!!!

6 Replies
Clever_Anjos
Employee
Employee

I think

sum({<FechaDocumento={">=$(=Date(today()-num(DiasFin),'DD/MM/YYYY'))"}*{"<=$(=Date(today() - num(DiasIni) , 'DD/MM/YYYY'))"}>}Value)

Will solve your need

chematos
Specialist II
Specialist II

Try this if the other doesn´t work:

sum({<FechaDocumento={'>=$(=Date(today()-num(DiasFin),'DD/MM/YYYY')) <=$(=Date(today() - num(DiasIni) , 'DD/MM/YYYY'))'}>}Value)

Regards

Anonymous
Not applicable
Author

Thanks for your help, but It don´t work. With If the result is this:

imagen1.png

but with the expressions sent the result always is 0.

imagen1.png

Anonymous
Not applicable
Author

Note that the solutions work when I have a selected range (DiasFin. DiasIni) but when I select multiple ranges shows 0. I hope you can help me.

Thanks you.

chematos
Specialist II
Specialist II

May be you could explain in more detail how are you doing the selections and what values have each field after that selections but as I understand your problem I think that if you want to select more than one range of dates you need to have one pair of fields for each range but you can´t make more than one selection for DiasFin or DiasIni, you should have DiasFin2, DiasIni2 to make another selection and add both ranges of dates to the expression.

sum({<FechaDocumento={'>=$(=Date(today()-num(DiasFin),'DD/MM/YYYY')) <=$(=Date(today() - num(DiasIni) , 'DD/MM/YYYY'))'}>}Value)

+

sum({<FechaDocumento={'>=$(=Date(today()-num(DiasFin2),'DD/MM/YYYY')) <=$(=Date(today() - num(DiasIni2) , 'DD/MM/YYYY'))'}>}Value)

Regards

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this

=sum({<FechaDocumento={">=$(=Date(today()-max(DiasFin),'DD/MM/YYYY')) <=$(=Date(today() - max(DiasIni) , 'DD/MM/YYYY'))"}>}Value)

Hope this should work.

Regards,

Jagan.