Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Count({<Date={'<=$currentDate)'}>}Date) doesn't return correct number?!

Hallo!

I'm running in some issue while using the count-function.

Like header shows i want to count dates, wich are smaller(before) the currentDate.

CurrentDate is a variable and changes.

But the function always returns the wrong(for me, maybe function is working correct) number...

If i have this table:

SerialDatePrice
12301-01-20135
23402-02-20136
34502-02-20137
12304-05-20138

and use function:

count({<Date={'<=$(currentDate)'}>}Date)

i would expect following result:

currentDatecount({<Date={'$(currentDate)'}>}Date)
01-01-20131
...1
02-02-20133
...3
03-03-20133
...3
04-05-20134

But its notSmiley Sad

If i check using FieldValue('Date',count({<Date={'<=$(currentDate)'}>}Date)) it returns wrong date.

It's much more in future, means the count-function returns a too big value...

Example:

currentDate = 23-01-2013

count({<Date={'<=$(currentDate)'}>}Date)=3

FieldValue('Date',count({<Date={'<=$(currentDate)'}>}Date))=03-03-2013                    (not always 2 days later, i didnt find an order)

Seems like i do not understand how the function works^^

What is wrong?

Thanks for reading,

Sarah

'Count({<Date={'$currentDate)'}>}Date)'  adjusted to 'Count({<Date={'<=$currentDate)'}>}Date)', after friendly hint from Joerg Hildebrandt

1 Solution

Accepted Solutions
Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

Ok, strange to say but a missing distinct was the problem...

If i use count({<Date={'<=$(currentDate)'}>}distinct Date) it is like expected...

But how makes this sense?

13 Replies
omyahamburg
Contributor II

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

If you change to count({<Date={'<=$(currentDate)'}>}Date)

this gives you the # of dates up to the date in the variable.

Works for me.

best regards

Joerg

Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

Yea you're right, but i also tried <= :-/

Anyway thank u!

And no, it dont returns the correct value...

I will cahnge the original post^^

I use this function so many times before, but this time its not working...

I realy doont know whats wrong:-(

omyahamburg
Contributor II

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

Can you post sample data ?

Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

No,sry i cantSmiley Sad
It's to complicated to rebuild it wit different data and names...
Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

scrabmle your data under document properties and reduce data - Can you share then?

Otherwise, make ur data a numeric. And then count the difference between today and the date, then you will get the count of days

Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

What is that scramble good for?

Does it make the data anonymous?

Another fact that i found is, that the higher the result is, the higher is the failure.

Means if i expected 8 its 10,if i expect 18 its 24....

And its not the numeric difference between "Today" and start, because sometime more than one serial_no occurres per day.

And somedays nothing occurres...

Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

scramble makes your data into nonsense. This means we cannot interpret anything from your dataset because its been manipulated.

Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

Hm, i cant see any difference but for more decimals?

And this project is much too big and includes data wich is much to sensitive...

I fear my company wouldn't agree...

I always check my data while creating some table boxes.

If i count the days "per hand" i see it returns  the wrong result...

Is there any possiblity that a table box doesn't shows whole data(no supress zero ect. is deactivated)?

If u know some technology's to proof i can do anything^^

It seems like my understanding of count-function is well, maybe some issue's in data?

Not applicable

Re: Count({<Date={'$currentDate)'}>}Date) doesn't return correct number?!

Ok, strange to say but a missing distinct was the problem...

If i use count({<Date={'<=$(currentDate)'}>}distinct Date) it is like expected...

But how makes this sense?

Community Browser