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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help required for calculation in chart for date difference

Dear Expert,

Need help for EQUNR_S to get Act_Typ difference for same field Doc-Date.

How to calculate the same in chart or while loading.

IDShip_KeyDoc_DateEQUNR_SAct_Typget date difference
10000000001000101397Z2001.02.20111397ER0
130000000002000101397Z3001.02.20111397E0.00
100760000001797000201397Z3010.06.20111397F129.00
100780000001798000201397Z3013.06.20111397D3.00
100800000001799000201397Z2013.06.20111397T0.00
112560000002262000101397Z2016.07.20111397ER33.00
131890000003284000101397Z3029.10.20111397I105.00

Thanks

Ashif

10 Replies
jagan
Partner - Champion III
Partner - Champion III

HI,

Try like this

Temp:

LOAD *, if(previous(EQUNR_S=EQUNR_S, Doc_Date - previous(Doc_Date),0) as TT,

if(previous(EQUNR_S<>EQUNR_S, 1, 0) AS Flag,

if(previous(EQUNR_S=EQUNR_S, RangeSum(Peek([TT]), Doc_Date - previous(Doc_Date)), (Doc_Date - previous(Doc_Date)) AS AccumSum

Resident Temp

Order By EQUNR_S, Doc_Date; 

Result:

NoConcatenate

LOAD *,

if(previous(EQUNR_S<>EQUNR_S, 1, 0) AS Flag

Resident Temp

Order By EQUNR_S, Doc_Date DESC; 

Now in front end

Chart : Straight Table

Dimension: EQUNR, Act_Typ

Expression: Sum({<Flag ={1}>}AccumSum)


REgards,

Jagan.