Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am stuck with a simple requirement and would appreciate your help in this:
I would like to know the user who made his first transaction in year 2012 and what what is the total sale done by him in a straight chart.
A:
LOAD * INLINE [
Year, Amt, User
2010, 100, A
2011, 200, B
2012, 500, C
2013, 400, D
2013, 900, B
2015, 100, C
];
Output: C =600
Hi Jyothish, May be like this?
Sum({<User={"=min(Year)=2012"}>}Amt)
Edit: simplified the expression
Hi Jyothish, May be like this?
Sum({<User={"=min(Year)=2012"}>}Amt)
Edit: simplified the expression
Thanks a lot for your help @tresesco 🙂
Try like this
A:
LOAD *,
If(Year<>Previous(Year) and User<>Previous(User) and Year='2012' ,1,0) as Flag;
LOAD * INLINE [
Year, Amt, User
2010, 100, A
2011, 200, B
2012, 500, C
2013, 400, D
2013, 900, B
2015, 100, C
];
User_mapping:
Mapping
LOAD
User,
Flag
Resident
A;
LOAD
Year,
User,
Amt,
ApplyMap('User_mapping',User,0) as User_Flag
Resident
A;
DROP Table A;
Thanks for the help bro 🙂