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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
becki_kain
Contributor III
Contributor III

loading more than one file or different view of same file?

i have this, in the load script:

Working:

LOAD YRMON,

     SEG,

     Segment,

     Segment2,

     Manufacturer,

     Brand,

    FROM

(qvx);

Segments:

LOAD * INLINE

[ Segment, SortOrder

Small B Car, 1

Small Premium Utility, 15

Mid-Size Pickup, 21

Full-Size Pickup, 22

Med & Heavy, 23

];

and that works fine (i took out lines for this question) and this file, PM_only.qvx, is all data.  I made two pivot tables from this data with expressions and that's working.  now, if want to either load in another .pvx file where Segment2='O8500' or Segment2='U8500' ONLY (with the exact same field names) or use the above file, brought in, but i only want to see where this criteria is met (Segment2='O8500' or Segment2='U8500'), i tried making this for forcing the load order:

Seg2s:

LOAD * INLINE

[ Segment2, SortOrder

O8500, 1

U8500, 2

];

and when i reload the script, i get a loop condition and my initial pivot charts are reduced to just that criteria, not the full amount of data.  How do I either load two different .pvx files in, and force a load order or force two load orders and a criteria, on the same data? 

thanks

becki kain

1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

May be as below:

Working:

LOAD
     YRMON,
     SEG,
     Segment,
     Segment2,
     Manufacturer,
     Brand,
     'First Table' as Type
FROM

(qvx);

LOAD YRMON,
     SEG,
     Segment,
     Segment2,
     Manufacturer,
     Brand,
     'Second Table' as Type
FROM

(qvx)
Where
Segment2='O8500' or Segment2='U8500' ;

Segments:

LOAD * INLINE
[ Segment, SortOrder
Small B Car, 1
Small Premium Utility, 15
Mid-Size Pickup, 21
Full-Size Pickup, 22
Med & Heavy, 23
];

Now you can use the field 'Type' and get the data either from First table or the Second table.

II. The second option is:

     Load the table only once and then use set analysis while calculating the expressions. for example:

      Sum({<Segment2={'O8500','U8500'}>}Amount)

and use the below expression where you do not want to mention Segment2='O8500' or Segment2='U8500' :

     Sum({<Segment2=>}Amount)

Hope this helps..

View solution in original post

7 Replies
becki_kain
Contributor III
Contributor III
Author

my question really is, can I do two load orders with the same data set, for 2 different pivot tables, using different fields for the ordering?

Anil_Babu_Samineni

To avoid of loops you can try this?

Working:

LOAD YRMON,

     SEG,

     Segment,

     Segment2,

     Manufacturer,

     Brand,

    FROM

(qvx) Where Segment2='O8500' or Segment2='U8500';

Segments:

LOAD * INLINE [

Segment, SortOrder

Small B Car, 1

Small Premium Utility, 15

Mid-Size Pickup, 21

Full-Size Pickup, 22

Med & Heavy, 23

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
becki_kain
Contributor III
Contributor III
Author

no, because I need all data, for the first pivot table but then a subset for the second pivot.  I can do the second pivot by adding in [Segment2]={U,O} in set analysis but how do I force the order of the rows, in the second pivot?  thanks

Anil_Babu_Samineni

Not sure, I understand your issue. Will you provide sample data set and expected result

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
trdandamudi
Master II
Master II

May be as below:

Working:

LOAD
     YRMON,
     SEG,
     Segment,
     Segment2,
     Manufacturer,
     Brand,
     'First Table' as Type
FROM

(qvx);

LOAD YRMON,
     SEG,
     Segment,
     Segment2,
     Manufacturer,
     Brand,
     'Second Table' as Type
FROM

(qvx)
Where
Segment2='O8500' or Segment2='U8500' ;

Segments:

LOAD * INLINE
[ Segment, SortOrder
Small B Car, 1
Small Premium Utility, 15
Mid-Size Pickup, 21
Full-Size Pickup, 22
Med & Heavy, 23
];

Now you can use the field 'Type' and get the data either from First table or the Second table.

II. The second option is:

     Load the table only once and then use set analysis while calculating the expressions. for example:

      Sum({<Segment2={'O8500','U8500'}>}Amount)

and use the below expression where you do not want to mention Segment2='O8500' or Segment2='U8500' :

     Sum({<Segment2=>}Amount)

Hope this helps..

becki_kain
Contributor III
Contributor III
Author

I did this:

drop table Segments;

Seg2:
LOAD * INLINE
[ Segment2, SortOrder
Full-Size Pickup - U8500, 1
Full-Size Pickup - O8500, 2
]
;

to get around the loop and yes, i'll have to do really long set analsys to just pull in those two sub segments.  thanks

becki_kain
Contributor III
Contributor III
Author

and then i lose my load order for "Segments" when i do the drop