Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i want to load data for Domain ,SubDomain,Visit
1.for Domain i want to load only those rows which is not eqal to total .
2.for SubDomain i want to load rows which is not equal to total but if count of Domain is equal to 1 then i also need to load total for that row .
is there any way to do this.
Sample data:
Domain | SubDomain | Visit |
abc | abc1 | 10 |
abc | abc1 | 10 |
abc | abc1 | 10 |
abc | abc1 | 10 |
abc | total | 50 |
xyz | total | 20 |
ghj | ghj1 | 30 |
ghj | ghj1 | 30 |
ghj | ghj1 | 30 |
ghj | ghj1 | 30 |
ghj | total | 120 |
jkl | total | 80 |
total | total | 430 |
Load table should be like as:
Domain | SubDomain | Visit |
abc | abc1 | 10 |
abc | abc1 | 10 |
abc | abc1 | 10 |
abc | abc1 | 10 |
xyz | total | 20 |
ghj | ghj1 | 30 |
ghj | ghj1 | 30 |
ghj | ghj1 | 30 |
ghj | ghj1 | 30 |
jkl | total | 80 |
Hi,
Try like this,
Testing:
Load * Inline
[
Domain,SubDomain,Visit,
abc,abc1,10
abc,abc1,10
abc,abc1,10
abc,abc1,10
abc,total,50
xyz,total,20
ghj,ghj1,30
ghj,ghj1,30
ghj,ghj1,30
ghj,ghj1,30
ghj,total,120
jkl,total,80
total,total,430
] where Domain <> 'total';
Load if(Previous(Domain) = Domain and SubDomain = 'total','',SubDomain) as SDomain,if(Previous(Domain) = Domain and SubDomain = 'total','',Domain) as Domain1,
if(Previous(Domain) = Domain and SubDomain = 'total','',Visit) as Visit1 Resident Testing;
Drop Table Testing;
Hope it helps