Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate nr of days from start to stop

Hi

Now I´m stucked, I have tried to figuer out a way to calculate number of days from from start to stop date but have not succed.

Attached are a qvd with simplyfied data for two cases.

I want the Date (field in qvd = Datum) for the decisiondate (Atgardkod = BES) - Startdate (Datum for "Lopnummer" = 1 )

Like ... If(Atgardkokd = 'BES', Date(Datum) - If(Lopnummer = 1, Date(Datum) as WaitingTime

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try a straight table chart with dimension %DiarieKey and as expression:

=only({<Atgardkod= {BES}>}Datum ) - only({<Lopnummer={1}>} Datum)

Hope this helps,

Stefan

edit:

Or if you want to do it in the script:

INPUT:

LOAD %DiarieKey,

     DatumOrginal,

     Datum,

     Atgardkod,

     Lopnummer,

     BesDate,

     AnsDate

FROM

.\Tmp.qvd

(qvd);

LOAD %DiarieKey, 

          only(If(Atgardkod = 'BES', Datum)) - only(If(Lopnummer = 1, Datum)) as WaitingTime

Resident INPUT group by %DiarieKey;

added script based solution

View solution in original post

2 Replies
swuehl
MVP
MVP

Try a straight table chart with dimension %DiarieKey and as expression:

=only({<Atgardkod= {BES}>}Datum ) - only({<Lopnummer={1}>} Datum)

Hope this helps,

Stefan

edit:

Or if you want to do it in the script:

INPUT:

LOAD %DiarieKey,

     DatumOrginal,

     Datum,

     Atgardkod,

     Lopnummer,

     BesDate,

     AnsDate

FROM

.\Tmp.qvd

(qvd);

LOAD %DiarieKey, 

          only(If(Atgardkod = 'BES', Datum)) - only(If(Lopnummer = 1, Datum)) as WaitingTime

Resident INPUT group by %DiarieKey;

added script based solution

Not applicable
Author

Thanks. The Only function was new for me.