Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How can I use fieldnames as calendar date chart dimension

Hi, Qlikview beginner question.

I have the following database table..

COST CENTRESCH1SCH2SCH3SCH4SCH5
A26123
B02860
C18900
A25340
C50606

The SCH1 in reality represents today, SCH2 represents today+1 day (ie. tomorrow), SCH3 represent today+2 days (ie. the day after tomorrow), and so on ...

I need to create a chart where the X-Axis (dimension?) is the date and the Y-Axis (expression?) is the sum of the specific date.

The cost centre would be in a list box and when I choose a particular cost centre the chart would show the relevant data for that cost centre.

Any help will be appreciated.

Thanks

5 Replies
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

see attachment

SCRIPT

Source:

CrossTable(SCH, Value) LOAD *;

LOAD * INLINE [

COST CENTRE, SCH1, SCH2, SCH3, SCH4, SCH5

A, 2, 6, 1, 2, 3

B, 0, 2, 8, 6, 0

C, 1, 8, 9, 0, 0

A, 2, 5, 3, 4, 0

C, 5, 0, 6, 0, 6

];

T:

load

[COST CENTRE],

date(Today() + right(SCH, len(SCH)-3)-1) as Date,

Value

Resident

Source;

DROP Table Source;

Not applicable
Author

Excuse my newbiness .... but in reality my source data is coming from an SQL through the code below.  I cannot type all the values in the script as there are thousands of rows of data.  How to I adapt the above code to fit this?

SQL SELECT
    COST CENTRE,
    SCH1,
    SCH2,
    SCH3,
    SCH4,
    SCH5,
FROM BULEAS1.PMFDATA.KBOARD;

maxgro
MVP
MVP

try to replace the inline load with your statement

Source:

CrossTable(SCH, Value) LOAD *;

SQL SELECT

    COST CENTRE,

    SCH1,

    SCH2,

    SCH3,

    SCH4,

    SCH5,

FROM BULEAS1.PMFDATA.KBOARD;

T:

load

[COST CENTRE],

date(Today() + right(SCH, len(SCH)-3)-1) as Date,

Value

Resident

Source;

DROP Table Source;

Not applicable
Author

Thanks I managed to do the first part.  Have another related question if you do not mind.

In addition to the above I have also another fieldname [BACKLOG] in the SQL table.  I would like this to be shown in the same chart (on the X-Axis) before all the dates.

So far this is how my script looks...

SQL SELECT
    ITEMCODE,
    BCKLOG,
    SCH1,
    SCH2,
    SCH3,

    SCH4,
    SCH5,
    SCH6,
    SCH7
FROM BULEAS1.PMFDATA.KBOARD;

Source:
CrossTable(SCH, Value) LOAD *;
LOAD *;
SQL SELECT
    ITEMCODE,
    SCH1,
    SCH2,
    SCH3,
    SCH4,
    SCH5,
    SCH6,
    SCH7
FROM BULEAS1.PMFDATA.KBOARD;

T:
load
[ITEMCODE],
date(Today() + right(SCH, len(SCH)-3)-1) as Date,
Value
Resident
Source;
DROP Table Source;