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

Création intervalles d'heures

Bonjour à tous

Je suis nouveau sur Qlik et j'ai un petit soucis que je n'arrive pas à résoudre, peut être saurez vous éclairer ma lanterne :

J'ai des résultats de tests qui sont rangés dans un tableau en fonction de l'heure :

11:48bien
12:06assez bien
12:23bien
12:46bien

 

J'ai plus d'une centaine de tests sur la journée et j'aimerai grouper mes heures en intervalles par exemple de 00:00 à 06:00 et que Qlik me comptabilise le nombre de tests dans cet intervalle

J'ai bien essayé avec des COUNT et CONCAT mais je bloque....

Merci pour votre aide précieuse 🙂

Labels (1)
1 Solution

Accepted Solutions
mato32188
Specialist
Specialist

Hi Louis,

I do not speak French, but Google Translator is actually very good these days.

Script:

tmp:
load * Inline [
Time,Rating
11:48,bien
12:06,assez bien
12:23,bien
12:46,bien
];


intervals:
load * Inline [
IntervalStart, IntervalEnd
00:01, 06:00
06:01, 12:00
12:01, 18:00
18:00, 00:00
];

left join(tmp)
IntervalMatch(Time)
load IntervalStart, IntervalEnd Resident intervals;

drop table intervals;

Final:
Load
IntervalStart&' - '& IntervalEnd as Interval,
Time,
Rating
Resident tmp;
drop table tmp;

Visualization:

Stacked bar chart

Dims: Interval, Rating

Measure: Count (Rating)

mato32188_0-1617975616391.png

 

For more information please find https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Scrip...

BR

m

 

ECG line chart is the most important visualization in your life.

View solution in original post

5 Replies
mato32188
Specialist
Specialist

Hi Louis,

I do not speak French, but Google Translator is actually very good these days.

Script:

tmp:
load * Inline [
Time,Rating
11:48,bien
12:06,assez bien
12:23,bien
12:46,bien
];


intervals:
load * Inline [
IntervalStart, IntervalEnd
00:01, 06:00
06:01, 12:00
12:01, 18:00
18:00, 00:00
];

left join(tmp)
IntervalMatch(Time)
load IntervalStart, IntervalEnd Resident intervals;

drop table intervals;

Final:
Load
IntervalStart&' - '& IntervalEnd as Interval,
Time,
Rating
Resident tmp;
drop table tmp;

Visualization:

Stacked bar chart

Dims: Interval, Rating

Measure: Count (Rating)

mato32188_0-1617975616391.png

 

For more information please find https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Scrip...

BR

m

 

ECG line chart is the most important visualization in your life.
LouisD
Contributor II
Contributor II
Author

Hello Mato

Thank you very much for te reply and for the help, i wouldn't have figured this out by myself.

I will try this out today with my data and let you know if everthing works fine.

Thanks a lot, and thanks google trad 🙂

Have a nice day

Louis

LouisD
Contributor II
Contributor II
Author

Hello again 🙂

I modified a little the script in the begining and added more intervals :

TEST2:
LOAD *inline [Ark1.Time, Ark1.TestResult];
LOAD Ark1.Time, Ark1.TestResult
Resident [MYTABLE];

intervals:
load * Inline [
IntervalStart, IntervalEnd
00:01, 06:00
06:01, 12:00
12:01, 18:00
18:00, 00:00
];

left join(TEST2)
IntervalMatch(Ark1.Time)
load IntervalStart, IntervalEnd Resident intervals;

drop table intervals;

Final:
Load
IntervalStart&'-'& IntervalEnd as Interval,
Ark1.Time,
Ark1.TestResult
Resident TEST2;
drop table TEST2;

 

The visualization works just fine too, just a problem with the first column '-', i do not know how to remove that properly. The last interval doesnt show up too in the vizualisation chart.

Qlik Sense - Sans titre - Graphique en barres - 12 avril 2021.png

 

Thanks a LOT for your help

Have  a very nice day

Louis

 

mato32188
Specialist
Specialist

Hi Louis,

it is caused by my mistake. As you can see, last interval starts at 18:01 and ends 00:00. I forgot that we are working with 24h mode, not 12h mode. Quick fix: I would suggest you to change code below:

intervals:
load * Inline [
IntervalStart, IntervalEnd
00:00, 05:59
06:00, 11:59
12:00, 17:59
18:00, 23:59;

BR

m


];

ECG line chart is the most important visualization in your life.
LouisD
Contributor II
Contributor II
Author

Hello Mato

It is working just fine 🙂

Thanks a lot have a very nice day

Louis