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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

shift differential calculation

Hello,

I have big troubles with calculation some values, because our company wants that i calculate data by date, BUT where the day begins with 6am and ends with 6am on the next morning.

How can i calculate this differential when i have seperate data for year, month, day, hour, minute?

Thanks, Armin

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel
MVP
MVP

or as you already have seperate fields for year, month, day, hour, minute:

LOAD *,

          Week(Date) as Week,

          Month(Date) as Month,

          Year(Date) as Year;

LOAD *,

          DayName(timestampfield-'06:00:00')) as Date;

LOAD Timestamp(Makedate(year, month, day)+Maketime(hour, minute)) as timestampfield,

        someotherfields

FROM yoursource;

hope this helps

regards

Marco

View solution in original post

3 Replies
MarcoWedel
MVP
MVP

subtract 6 hours from your timestamps and load the result as a new field.

MarcoWedel
MVP
MVP

something like:

LOAD *,

          Week(Date) as Week,

          Month(Date) as Month,

          Year(Date) as Year;

LOAD timestampfield,

          DayName(timestampfield-'06:00:00')) as Date,

          someotherfields

FROM yoursource;

MarcoWedel
MVP
MVP

or as you already have seperate fields for year, month, day, hour, minute:

LOAD *,

          Week(Date) as Week,

          Month(Date) as Month,

          Year(Date) as Year;

LOAD *,

          DayName(timestampfield-'06:00:00')) as Date;

LOAD Timestamp(Makedate(year, month, day)+Maketime(hour, minute)) as timestampfield,

        someotherfields

FROM yoursource;

hope this helps

regards

Marco