Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey,
Need help with a concatenation of three dimensions, Name, Type, and Date and need to flag a duplicate spend record that corresponds to the concatenation.
Ex:
Owner - John Doe
Type - Lodging
Date - 6/23/2015
Two records found for $175 dollars with the information above.
tmp:
LOAD
Owner ,
Type ,
Date ,
count(Owner) as qty
resident yourtable;
LEFT join (yourtable)
LOAD
Owner ,
Type ,
Date
1 as FlgDup
Resident tmp
where qty > 1;
drop table tmp;
Temp:
Load Owner, Type, Date, Owner&Type&Date as Key, Amount From ....
Final:
Load
*,
If(Key = Previous(Key) and Amount = Previous(Amount),1,0) as DuplicateFlag
Resident Temp Order By Key, Amount;
Drop Table Temp;
I guess the Amount should be also included in the key in this case.
Ideally, the amount needs to be in the key as well to flag the exact same transaction, but then that brings up another issue as to how to visualize it in a dashboard. This part is saying invalid for me:
tmp:
LOAD
Owner ,
Type ,
Date ,
count(Owner) as qty
resident yourtable;
Error is invalid expression
See if the attached helps...