Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

leandrocarisio
New Contributor II

Please, help! I can't select and subtract days from max(date)

Hello, please I would like some help with a problem using qlik sense.

I need to limit the data in a graphic to the last 14 days. I am trying to use the following expression in the dimension field:

=IF(DATE(CRESCIMENTO_BANCO_COMPLETO.DATA)>=DATE(MAX(CRESCIMENTO_BANCO_COMPLETO.DATA)-14),CRESCIMENTO_BANCO_COMPLETO.DATA)

If I use just

=CRESCIMENTO_BANCO_COMPLETO.DATA

The graphic plots ok, but with all data.

Thank you very much!

1 Solution

Accepted Solutions
leandrocarisio
New Contributor II

Re: Please, help! I can't select and subtract days from max(date)

Thank you Sunny and Gabriel, but I used another way and solved the problem:

In dimension fiel I used: =Date([CRESCIMENTO_BANCO_COMPLETO.DATA])

And in measure field I used:

IF(Rank([CRESCIMENTO_BANCO_COMPLETO.DATA]) <= 10,

Sum([CRESCIMENTO_BANCO_COMPLETO.TAMANHO])/1024

)

And now works well.

5 Replies

Re: Please, help! I can't select and subtract days from max(date)

Try this

=If(CRESCIMENTO_BANCO_COMPLETO.DATA >= Max(TOTAL CRESCIMENTO_BANCO_COMPLETO.DATA) - 14), CRESCIMENTO_BANCO_COMPLETO.DATA)

leandrocarisio
New Contributor II

Re: Please, help! I can't select and subtract days from max(date)

Hi, Sunny Talwar, thanks but did not work. I have the warning: invalid dimension.

When I use the bellow expression in the kpi object, just to try, it works fine, showing the correct date:

DATE(MAX(CRESCIMENTO_BANCO_COMPLETO.DATA)-14)

Gabriel
Valued Contributor II

Re: Please, help! I can't select and subtract days from max(date)

Hi,

May be try to convert the date to number like

IF(NUM(CRESCIMENTO_BANCO_COMPLETO.DATA)>=

NUM((MAX(CRESCIMENTO_BANCO_COMPLETO.DATA))-14),

CRESCIMENTO_BANCO_COMPLETO.DATA)

Hope it works

Re: Please, help! I can't select and subtract days from max(date)

My bad, try this

=If(CRESCIMENTO_BANCO_COMPLETO.DATA >= Max(TOTALCRESCIMENTO_BANCO_COMPLETO.DATA) - 14, CRESCIMENTO_BANCO_COMPLETO.DATA)

leandrocarisio
New Contributor II

Re: Please, help! I can't select and subtract days from max(date)

Thank you Sunny and Gabriel, but I used another way and solved the problem:

In dimension fiel I used: =Date([CRESCIMENTO_BANCO_COMPLETO.DATA])

And in measure field I used:

IF(Rank([CRESCIMENTO_BANCO_COMPLETO.DATA]) <= 10,

Sum([CRESCIMENTO_BANCO_COMPLETO.TAMANHO])/1024

)

And now works well.

Community Browser