Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to relate data extracted from an Excel source - once seperated?

With the script below I'm seperating data from four fields in an excel document using a WHERE clause. Does this mean that the records related to the LA LOAD scripts Year, Month, Day and Hour fields will be replaced with those records fro the CPU LOAD script?

Is there a way for me to use a sub-query to load data using one LOAD statement.

CPU:

Load

      HOST_SERVER as Server,

      LOGICAL_NAME as [CPU-Utilization],

      TIME_STAMP as [CPU-Utilization TimeStamp],

       Year(TIME_STAMP) as Year,

       Month(TIME_STAMP) as Month,

       Day(TIME_STAMP) as Day,

       Hour(TIME_STAMP) & ':00 - ' & (Hour(Date(TIME_STAMP,'hh:mm'))+1) & ':00' as Hour,

      MEAS_VALUE as [CPU-Utilization Value]

FROM

(biff, embedded labels)

where left (LOGICAL_NAME,4)='CPU-';

LA:

Load

      HOST_SERVER as Server,

      LOGICAL_NAME as [Load Average],

      TIME_STAMP as [Load Average TimeStamp],

       Year(TIME_STAMP) as Year,

       Month(TIME_STAMP) as Month,

       Day(TIME_STAMP) as Day,

       Hour(TIME_STAMP) & ':00 - ' & (Hour(Date(TIME_STAMP,'hh:mm'))+1) & ':00' as Hour,

      MEAS_VALUE as [Load Average Value]

FROM

(biff, embedded labels)

where left (LOGICAL_NAME,4)='Load';

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Your script doesn't make sence to me.

It creates synthetic tables am I right?

Why not just load it something like:

Load

      HOST_SERVER as Server,

      IF(LEFT(LOGICAL_NAME,4)='CPU-' , LOGICAL_NAME) as [CPU-Utilization],

      IF(LEFT(LOGICAL_NAME,4)='Load' , LOGICAL_NAME) as [Load Average],

      TIME_STAMP,

       Year(TIME_STAMP) as Year,

       Month(TIME_STAMP) as Month,

       Day(TIME_STAMP) as Day,

       Hour(TIME_STAMP) & ':00 - ' & (Hour(Date(TIME_STAMP,'hh:mm'))+1) & ':00' as Hour,

      IF(LEFT(LOGICAL_NAME,4)='CPU-', MEAS_VALUE) as [CPU-Utilization Value],

      IF(LEFT(LOGICAL_NAME,4)='Load', MEAS_VALUE) as [Load Average Value]

FROM

(biff, embedded labels)

Let me know if this is usefull ok?

Good luck,

Dennis.

View solution in original post

1 Reply
Anonymous
Not applicable
Author

Your script doesn't make sence to me.

It creates synthetic tables am I right?

Why not just load it something like:

Load

      HOST_SERVER as Server,

      IF(LEFT(LOGICAL_NAME,4)='CPU-' , LOGICAL_NAME) as [CPU-Utilization],

      IF(LEFT(LOGICAL_NAME,4)='Load' , LOGICAL_NAME) as [Load Average],

      TIME_STAMP,

       Year(TIME_STAMP) as Year,

       Month(TIME_STAMP) as Month,

       Day(TIME_STAMP) as Day,

       Hour(TIME_STAMP) & ':00 - ' & (Hour(Date(TIME_STAMP,'hh:mm'))+1) & ':00' as Hour,

      IF(LEFT(LOGICAL_NAME,4)='CPU-', MEAS_VALUE) as [CPU-Utilization Value],

      IF(LEFT(LOGICAL_NAME,4)='Load', MEAS_VALUE) as [Load Average Value]

FROM

(biff, embedded labels)

Let me know if this is usefull ok?

Good luck,

Dennis.