Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
andre_avenant
Contributor
Contributor

Creating a new dimension from a dimension or field

So how do i create a new dimension in the load script from lets say the following scenario:

LOAD
[transport_type] ,
[season],
[supplier],

but what i want is to create a new filed called say TRUCKTYPE on the following criteria:

the transport must be Road, the Season must be winter and supplier must be Ford and that I want to call Ford Truck,

then the transport must be Road, Season must be winter and supplier must be VW and that will be called VW Truck?

 

Basically creating a dimension based on certain current fields data

 

Regards

Labels (2)
4 Replies
Taoufiq_Zarra
Master II
Master II

several ways of doing it, if it's not a complicated calculation, I propose : if(Match(transport_type,'Road') and Match(season,'winter')and Match(supplier,'Ford'),'Ford Truck', if(Match(transport_type,'Road')and Match(season,'winter') and Match(supplier,'VW'),'VW Truck')) as TRUCKTYPE
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
andre_avenant
Contributor
Contributor
Author

Granted but what happens if you say for example what you gave and then the transport type must be road and gravel or you don't want gravel in the selection. But you don't want list the other transports type each individually?:
if(Match(transport_type,'Road')&Match(season,'winter')&Match(supplier,'Ford'),'Ford Truck',
if(Match(transport_type,'Road')&Match(season,'winter')&Match(supplier,'VW'),'VW Truck')) as TRUCKTYPE,
Taoufiq_Zarra
Master II
Master II

can you replace & by and , and share a sample data to understand better and maybe propose something else

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
andre_avenant
Contributor
Contributor
Author

Transport typeseasonsuppliermiles   
roadwinterVW200   
seasummerFord100   
snowautumToyota200   
gravelspringAudi200   
airwinterVW300   
roadwinterFord444   
seaautumToyota555   
roadsummerAudi222   
seasummerToyota1445   
roadsummerAudi60   
seasummerToyota50   
roadsummerVW40   
seasummerVW50   
snowsummerFord1   
gravelsummerToyota20   
airwinterAudi2   
       
so I want to create a new dimension from this and lets call it Transport
The criteria for transport is the following, 
if(supplier=VW & AUDI and the season =summer,german, if(supplier=VW & Ford and season = winter, Southafrica
But now if want to take these same if statements and just exclude vw,Audi,Ford without typing out the other brand how do you do it?