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

Intervalmatch not matching

Hello,

To start, I've used this method before with good success.  I'm using the some of the same data sources, a spreadsheet with 2 columns:

  

Interval StartInterval End
0:000:30
0:301:00
1:001:30
1:302:00

both fields of Excel Time type (13:30).  I load the Time Interval data last, after loading Employee Schedule data:

EWFMSchedule:

LOAD [Clndr Date] AS Date,

     [Agent Corp Login] AS Login,

     Code,

     Descr,

     Time([Start Moment]) AS [Start Moment],

     Time([Stop Moment]) AS [Stop Moment],

     Interval(Time([Stop Moment])-Time([Start Moment]), 'mm') AS Duration

FROM

[..\2.UserData\Shrink_EWFM_AgentSchedule.xlsx]

(ooxml, embedded labels, table is [EWFM Schedule]);

and then load the Interval data and finally, invoke the intervalmatch function:

TimeInterval:

LOAD Time([Interval Start]) AS [Interval Start],

     Time([Interval End]) AS [Interval End]

FROM

[..\2.UserData\TimeInterval.xlsx]

(ooxml, embedded labels, table is TimeInterval);

IntervalMatch:

IntervalMatch ([Start Moment])

Load distinct [Interval Start], [Interval End] resident TimeInterval;

When I drop all the components into a report block as List boxes, everything except Interval Start and Interval End work.  I can highlight a CODE, START or STOP MOMENT and all other objects filter correctly, except the Interval objects.

2.jpg

Finally, the data model looks correct as well:

1.jpg

Any suggestions would be appreciated.

Thank you!

Matthew Cummings

1 Solution

Accepted Solutions
Not applicable
Author

Solved!

I understand Qlikview stores datetime objects in the same manor as MS; as a double precision floating point number.  I created List boxes for each field of concern and created within each listbox, a formula converting the field to a number.  I observed the [Start Moment] from the Schedule table still had values to the left of the decimal point where the [Interval Start] fields only had a 0 to the left of the decimal (no days, only h:m:ss).

Further research revealed the Frac() function that effectively removes the whole integer from the field, leaving the decimal value:

     Time(Frac([Start Moment]), 'hh:mm:ss') AS [Start Moment]

Now my Intervalmatch function is comparing "Apples with Apples"

Before:

1.jpg

After:

2.jpg

The moral of this story is to take a close look at the underlying datatype before soliciting advice on a forum!

Thanks!

View solution in original post

4 Replies
Not applicable
Author

Additional Information:  If I'm reading the tea leaves correctly, the Intervalmatch() function is returning 0 matches.

1.jpg

I've tried a few tricks to make all datatypes the same and on the report block they look the same but repeated efforts to link the [Start Moment] to either of the TimeInterval fields has failed.  I've tried simple If statements to compare the fields "If([Start Moment]=[Interval Start], 1, 0) knowing that some of the Start Moments line up with some of the Interval Start times but to no avail.  There seems to be some internal differences between the two fields.

All responses are greatly appreciated!

Not applicable
Author

Solved!

I understand Qlikview stores datetime objects in the same manor as MS; as a double precision floating point number.  I created List boxes for each field of concern and created within each listbox, a formula converting the field to a number.  I observed the [Start Moment] from the Schedule table still had values to the left of the decimal point where the [Interval Start] fields only had a 0 to the left of the decimal (no days, only h:m:ss).

Further research revealed the Frac() function that effectively removes the whole integer from the field, leaving the decimal value:

     Time(Frac([Start Moment]), 'hh:mm:ss') AS [Start Moment]

Now my Intervalmatch function is comparing "Apples with Apples"

Before:

1.jpg

After:

2.jpg

The moral of this story is to take a close look at the underlying datatype before soliciting advice on a forum!

Thanks!

MarcoWedel

maybe try with

Time(Frac([Start Moment])) AS [Start Moment]


instead of


Time([Start Moment]) AS [Start Moment]


same for all other time fields.

hope this helps

regards

Marco

Anonymous
Not applicable
Author

may be helpful for you?

IntervalMatch on Time field