Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In following inline script I'm trying to load data and in pivot table I'm selecting Sub-Category,Product as the Dimension, I need to display the products as load order so I'm selection Load order as a order for product in sorting but its not working.
Somehow cant upload QVW file, the product Total for the Stuff Sub-Category, displays first, its last item in the list so it should be displayed last.
stat_group:
LOAD * INLINE [
Caregoty, Sub-Category, Product
Home, Baby, Toy 1
Home, Baby, Toy 2
Home, Baby, Toy 3
Home, Baby, Toy 4
Home, Baby, Toy 5
Home, Garden, Plant 1
Home, Garden, Plant 2
Home, Garden, Plant 3
Home, Garden, Plant 4
Home, Garden, Plant 5
Home, pool, pool1
Home, pool, pool2
Home, pool, Total
Home,Stuff, 65 and Over
Home,Stuff, Under 65 (Including )
Home,Stuff, Total
];
It doesn't care about the Sub-Category. It's giving you the data in load order, and 'Total' was loaded first. There's an open suggestion for the product to support sorting the second dimension in the context of the first. I know I've seen people work around it and get it to sort properly, but I can't remember the technique they used.
Thanks for quick reply.
But I cant see how did total loaded first?? its last column in the list.
NishPatel wrote:But I cant see how did total loaded first?? its last column in the list.
Actually, no it isn't. Take another look at your list, but this time try to be as dumb as a computer instead of being a smart person that understands the data. If you simply scan down the list, you'll run across 'Total' before you run across the two others. The first time you see it is on the fourth row up from the bottom, not the last in the list. Now yes, YOU know that what you mean by last in the list is last in the context of the Sub-Category. But QlikView doesn't realize that. It's just scanning the list naively during the original load.
..Thanks !!
By the way i read something about using Dual(), but it dint work. any thought on that??
Dual wouldn't work because it needs to assign a UNIQUE numeric value to each text value. So "Total" could have whatever numeric value you wanted, but would only have a single numeric value. I forget what happens if you try to assign a second numeric value. I think it should give an error, but I think it actually just ignores the second numeric value and acts like everything is fine, until you go to try to sort by it and it just doesn't do what you intended.
Looks like for your sample data at least, you can solve your sorting issues by putting in this sort expression in addition to the load order sort:
if("Product"='Total',99999999)
That seems to override the sort order, but only for Total, putting Total at the bottom.