Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I only want to count the test_id's when the interventiondate is later in time then the datetime.
The expression below I used doesn't work:
count(distinct {<interventiondate={">datetime"} >} test_id)
How do I write this?
Kind regards,
Katleen
Yes. This is because we are essentially doing TWO loads. The top one is a load FROM the bottom one. So since you change the name of the field interventiondate, it no longer exists in the top load.
change to:
load *,
if(acties_totaal_interventiondate>=acties_totaal_datetime,1,0) as IntDateBiggerThanDateTimeFlag;
LOAD _id as test_id,
_address_id as addresses_id,
action_category,
actionname,
status as acties_totaal_status,
interventiondate as acties_totaal_interventiondate,
process_datetime as acties_totaal_datetime
FROM
[..\2. Extraction to QVD layer\QVD_Ettenleur\Actions_69.qvd]
(qvd);
If you are fine with date format use this: count({<interventiondate={">datetime"} >} distinct test_id)
else convert the datetime to the format you use and try this:
count({<interventiondate={">$(=Date(datetime))"} >} distinct test_id)
Apparently I also need to count when the dates are the same.
I tried to adapt it like this, but it doesn't work:
count({<interventiondate={">=$(=Date(datetime))"} >} distinct test_id)
What did I do wrong this time?
Make sure date format of both is same
interventiondate is a datefield.
datetime is a timestamp, but that should be solved with the date(datetime) function, no?
use count({<interventiondate={">=$(=Date#(datetime,'DD.MM.YY hh:mm:ss'))"} >} distinct test_id)
replace 'DD.MM.YY hh:mm:ss' with the format you use for the timestamp.
However if you want this to work as FOR each line: if interventiondate >= datetime count(distinct test_id) .
Then you have to use
sum(aggr(count({<interventiondate={">=$(=Date#(datetime,'DD.MM.YY hh:mm:ss'))"} >} distinct test_id),test_id))
Still doesn't seem to work, I have attached a qvw witch some sample data.
Can you take a look at it?
Kind regards,
Katleen
See the attached file
In your load script change it into the following:
Actions:
load *,
if(interventiondate>=datetime,1,0) as IntDateBiggerThanDateTimeFlag;
LOAD _id as id,
action_category,
actionname,
status,
interventiondate,
process_datetime as datetime
FROM
[Apps\2. Extraction to QVD layer\QVD_Ettenleur\Actions_69.qvd]
(qvd);
Then your expression becomes:
count({$<IntDateBiggerThanDateTimeFlag={1}>} distinct id)