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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
KarimBen
Contributor II
Contributor II

Seperate Interval Sums

Hi everyone, 
thanks to @MarcoWedel  and @Taoufiq_Zarra , i was able to solve the following task perfectly:     https://community.qlik.com/t5/App-Development/Sum-of-Productive-Runtime-of-Maschines/m-p/1879818#M72...

However, the summaries go over several days. But I have to make precise evalations for the day. 


2022-01-12 13_11_25-MPS-BDE-Datenload(1) - Solution 1 _ Arbeitsblatt - Qlik Sense und 5 weitere Seit.png

1 Solution

Accepted Solutions
MarcoWedel

Hi,

you can just use the autoCalendar Date field derived from the start timestamp (StartDatumZeit) of each sub interval:

 

MarcoWedel_0-1642267527477.png

 

MarcoWedel_2-1642267867314.png

 

hope this helps

Marco

 

 

 

 

 

View solution in original post

5 Replies
MarcoWedel

Hi,

if there are intervals spanning across multiple days, you have to split these intervals in daily sub-intervals to be able to aggregate on day level.

Extending my example from https://community.qlik.com/t5/App-Development/Sum-of-Productive-Runtime-of-Maschines/m-p/1879818 this could be done like this:

 

tabMaschinenLaufzeitenTemp:
LOAD rowid as %rowid,
     Timestamp#(Replace(Left(timestamp,26),'T',' '),'YYYY-MM-DD hh:mm:ss.fffffff') as DatumZeit,
     timestamp,
     tier1 						as Grün,
     tier2						as Gelb,
     tier3						as Rot,
     If(tier1=0 and tier2=0 and tier3=0,1) as Counter,
    
     If( tier1=1, 'läuft',
      If(tier1=0 and tier2=0 and tier3=0,'nicht produktiv',
      If(tier1=2, 'Schacht i.O. voll',
      If(tier2=1, 'Einrichten',
      If(tier2=2, 'Schacht nicht erfasst voll',
      If(tier3=1, 'Störung',
      If(tier3=2, 'Schacht n.i.O. voll'    
      ))))))) as IndiCom,
      
     If(tier1=1, Dual('läuft',1), Dual('läuft nicht',0)) as Lauf,
     
     [slaveref/refid],
      Pick(Match([slaveref/macid],'00A391','00A399'),'Brune4','Brune7') as Slave,
     %Key_data_CD43325B85172CA2
FROM [lib://C_Temp/MDE_Export.xml] (XmlSimple, table is [data/slavestate]);

tabMaschinenLaufzeiten:
LOAD *,
     Interval(EndDatumZeit-StartDatumZeit) as Dauer;
LOAD *,
     Timestamp(RangeMax(DatumZeit,       DayStart(DatumZeit,IterNo()-1)),'YYYY-MM-DD hh:mm:ss.fff') as StartDatumZeit,
     Timestamp(RangeMin(NaechstesDatumZeit,DayEnd(DatumZeit,IterNo()-1)),'YYYY-MM-DD hh:mm:ss.fff') as   EndDatumZeit
While IterNo() <= Alt(DayStart(NaechstesDatumZeit)-DayStart(DatumZeit)+1,1);
LOAD *,
     If(Slave=Previous(Slave), Previous(DatumZeit)) as NaechstesDatumZeit
Resident tabMaschinenLaufzeitenTemp
Order By Slave, %rowid desc;

DROP Table tabMaschinenLaufzeitenTemp;

 

splitting this initial intervals

2022-01-13 18_27_02-Qlik Sense Desktop.png

 

into these

2022-01-13 18_35_40-Ausschneiden und skizzieren.png

 

thus enabling aggregations on day level:

MarcoWedel_0-1642096287518.png

 

hope this helps

Marco

 

 

 

 

 

 

KarimBen
Contributor II
Contributor II
Author

Hello Marco, 
thank you very much. 
I get the table view, like yours. 
But my Barchart is giving wrong values. 

Ho do you generate your "Datum" field. 
Best regards2022-01-14 12_37_35-MPS-BDE-Datenload(1) - Solution 1 _ Arbeitsblatt - Qlik Sense und 1 weitere Seit.png2022-01-14 12_35_39-MPS-BDE-Datenload(1) - Mein neues Arbeitsblatt _ Arbeitsblatt - Qlik Sense und 1.png

MarcoWedel

Hi,

you can just use the autoCalendar Date field derived from the start timestamp (StartDatumZeit) of each sub interval:

 

MarcoWedel_0-1642267527477.png

 

MarcoWedel_2-1642267867314.png

 

hope this helps

Marco

 

 

 

 

 

KarimBen
Contributor II
Contributor II
Author

2022-01-17 09_59_15-WDADesktopService.png

 

Hello Marco Thank you a lot, 
Now i got it. It is perfect. 

MarcoWedel

you're welcome

glad it helped