Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
AycaAltiparmak
Contributor
Contributor

Creating & Using A New Dimension viaLoad Script

Hi All,

I would like to create a new dimension to use in my dashboard. I have a product hierarchy from HANA. I put an if statement to divide it into segments. But I could not see it when creating a new chart as a dimension. Do you have any idea?

Load PRHDA,
if((left(PRDHA,2)='BA' OR left(PRDHA,2)='BC' OR left(PRDHA,2)='BD' OR left(PRDHA,2)='BM' OR left(PRDHA,2)='BN' OR left(PRDHA,2)='BY' OR left(PRDHA,2)='BZ') ,'FDO',
if((left(PRDHA,2)='3F'OR left(PRDHA,2)='3P'),'FS',
if((left(PRDHA,2)='BB' OR left(PRDHA,2)='BE' OR left(PRDHA,2)='BG' OR left(PRDHA,2)='BH' OR left(PRDHA,2)='BK' OR left(PRDHA,2)='BL' OR left(PRDHA,2)='BO' OR left(PRDHA,2)='BP' OR left(PRDHA,2)='BQ' OR left(PRDHA,2)='BR' OR left(PRDHA,2)=' BS' OR left(PRDHA,2)='BU' OR left(PRDHA,2)='BW' OR left(PRDHA,2)='BF'),'SRA'))) AS NewSegment
From [DATALOCATION];
Load NewSegment;

Labels (3)
7 Replies
PrashantSangle

Hi,

from this code which field you are not getting in front end??

 

Regards,

max

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle

can you post your complete code over here? if you are getting any error during reload then share that too.

 

Regards,

max

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
AycaAltiparmak
Contributor
Contributor
Author

I could not see the 'New Segment' as a dimension in front end in any chart.

AycaAltiparmak
Contributor
Contributor
Author

My aim is to create a new dimension by using a current dimension- field name PRDHA. I created if conditions in the above code but still could not see the dimension in front end.

PrashantSangle

did you reload dashboard after you modified the script. If yes then take filter pane from left panel. and add new segment in it.

you will also find that field in left Field section.

 

Regards,

max

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle

I got that just reload the dashboard and see .

By the way you can wildmatch() or match() to reduce if condition. for more details see in help menu

 

Regards,

max

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Angela_Zhou
Contributor III
Contributor III

I believe you renamed your new Dimension as "NewSegment" without space, and remove last line of "Load NewSegment;", which seems not necessary.

Also, suggest you using match to reduce OR inside IF statement as below,

 

Load PRDHA,
if(Match(left(PRDHA,2), 'BA','BC','BD','BM','BN','BY','BZ')>0,'FDO',
   if(Match(left(PRDHA,2), '3F','3P')>0,'FS',
      if(Match(left(PRDHA,2), 'BB','BE','BG','BH','BK','BL','BO','BP','BQ','BR','BS','BU','BW','BF')>0,'SRA','Other')
   )
) AS NewSegment
From [DATALOCATION];

 

Angela Z.