Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis compare dates

Hello

I need to count the days selected until today.

I want to do something like this:

COUNT(DISTINCT {$<Fecha={<today()}>} Fecha)

But it goes wrong.

"Fecha" is a field in data format. If I show this field for today i see 42110,

Could someone tells me how must i do?

Thanks,

Fernando

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi, Fernando.

Try  this

create two variables

MinDate= min(Fecha)

MaxDate= Today()

Your  Expression:

=count({$<Fecha={"<=$(MaxDate)>=$(MinDate)"}>} DISTINCT Fecha)

View solution in original post

11 Replies
swuehl
MVP
MVP

Try a Dollar sign Expansion and search in your set modifier:

COUNT(DISTINCT {$<Fecha={"<$(=num(today()))"}>} Fecha)

buzzy996
Master II
Master II

u can try this,

=networkdays( Fecha,today())

Fecha* should be date field

Not applicable
Author

Hi swuehl;

This doesn't go well.

No t return the true result 😞

Thanks

Not applicable
Author

Hi Shiva;

The expression goes well but I need another thing. I need do it in set analysis.

Thanks a lot. I don't knew the networkdays function 🙂

buzzy996
Master II
Master II

it's calculate accurate days in this case,and we can also use in different purpose to exclude holidays in other cases..

buzzy996
Master II
Master II

if ur happy with tht...u can mark as correct

Not applicable
Author

I need that someone tells me how do the same with the set analysis.

I mark the like  button

Anonymous
Not applicable
Author

Hi, Fernando.

Try  this

create two variables

MinDate= min(Fecha)

MaxDate= Today()

Your  Expression:

=count({$<Fecha={"<=$(MaxDate)>=$(MinDate)"}>} DISTINCT Fecha)

Not applicable
Author

Hi Jannet;

I have to learn more about the use of $(...).

The solution you gave me is just what I needed.


Before I wrote here I tried to do this:

COUNT(DISTINCT {$<Fecha={<today()}>} Fecha

The correct expression is:

count({$<Fecha={"<$(=Today())"}>} DISTINCT Fecha)


I know is better to use variables but I wanted understand why didn't goes well the expression


Thanks a lot

Fernando