Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 AycaAltiparmak
		
			AycaAltiparmak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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;
 PrashantSangle
		
			PrashantSangle
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
from this code which field you are not getting in front end??
Regards,
max
 PrashantSangle
		
			PrashantSangle
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		can you post your complete code over here? if you are getting any error during reload then share that too.
Regards,
max
 AycaAltiparmak
		
			AycaAltiparmak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I could not see the 'New Segment' as a dimension in front end in any chart.
 AycaAltiparmak
		
			AycaAltiparmak
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
		
			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
 PrashantSangle
		
			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
 Angela_Zhou
		
			Angela_Zhou
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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];
