Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Counting back from a selected date

Hello!

I need to create ''count'' the number of dates there since I select date (including this) backwards. I  tried with ''GetTheFieldSelection''  and put it in a script with SET, but I could not.

The program did not recognize it as a function I believe, and I am new in Qlik

Other ways I tried is this, that only works if I'm not selecting anything. When I make a selection, the result always gives the same.


count ({<FechaDeBaja = { "<= $ (max (date (FechaDeBaja)))"}>} FechaBaja)

Thank you very much!

12 Replies
johnw
Champion III
Champion III

When you say "doesn't work", what do you mean?

Could you give us some example data and expected result for a selection? If everything we suggest is returning 0, or "doesn't work", I suspect your data doesn't look like we are imagining it looks.

For example, I'm imagining a table like this:

FechaBaja  Some Other Fields
28/10/2016 blah blah  blah
28/10/2016 blah blah  something
29/10/2016 blah blah  blah
30/10/2016 blah blah  blah
31/10/2016 blah blah  blah

Now let's say we select 2016-10-31. I would expect my expression (with the field name corrected) to work like this:

max(FechaBaja) - min({1} FechaBaja) + 1
= 2016-10-30 - 2016-10-28 + 1
= 3

That's my understanding of what you're asking for, that you would want 3 returned for this case. Or we can look at Sunny's expression.

Count({<FechaBaja = {"<=$ (=Date(Max(FechaBaja), 'DD/MM/YYYY'))"}>} FechaBaja)
= Count({<FechaBaja = {"<=30/10/2016"}>} FechaBaja)
= count 28/10/2016 and 28/10/2016 and 29/10/2016 and 30/10/2016
= 4

I don't think you want 4, but that's fixed by adding a "distinct", and then it would be 3. But you say you got 0.

So I suspect your data doesn't look like my example above.

Not applicable
Author

Hi,Can you share the sample application to demonstrate your issue?

jvitantonio
Specialist III
Specialist III

Florencia, you started the same post three times GedtTheField selection? Contar de la fecha seleccionada hacia atras

GedtTheField selection? Contar de la fecha seleccionada hacia atras

set analysis y getfieldselections

For respect to those who are helping you, could you please keep only one post open and close the others?

Thanks,

Juan