Skip to main content
Announcements
Global Transformation Awards submissions are open! SUBMIT YOUR STORY
cancel
Showing results for 
Search instead for 
Did you mean: 
abedalraheem
Contributor
Contributor

aggre() between null and value

Hi every body 

I have the below data in my database  :

policy NoEndorsement No
P1 
P1E1
P2 
P2E1
P3 

 

and I want to load it to be like the below table , means if there is a value for P1 take it if not put it as null .

 

Policy NoEndorsement No
P1E1
P2E1
P3 

 

I tried to use Only function but it does not work with me , any one faced this before .

appreciate your help .

 

1 Reply
sunny_talwar

May be try this

Table:
LOAD [policy No],
	 MaxString(If(Len(Trim([Endorsement No])) > 0, [Endorsement No])) as [Endorsement No]
Group By [policy No];
LOAD * INLINE [
    policy No, Endorsement No
    P1,  
    P1, E1
    P2,  
    P2, E1
    P3,  
];

I used If statement to make sure that Endorsement No was forced to be null as I was loading it from an Inline table... but if you have true nulls coming from your source data... MaxString([Endorsement No]) should work for you....