Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jyothish8807
Master II
Master II

Need help with logic

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

Best Regards,
KC
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Hi Jyothish, May be like this?

Sum({<User={"=min(Year)=2012"}>}Amt)

 

 Capture.JPG

 

Edit: simplified the expression

View solution in original post

4 Replies
tresesco
MVP
MVP

Hi Jyothish, May be like this?

Sum({<User={"=min(Year)=2012"}>}Amt)

 

 Capture.JPG

 

Edit: simplified the expression

jyothish8807
Master II
Master II
Author

Thanks a lot for your help @tresesco 🙂

Best Regards,
KC
avinashelite

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;

jyothish8807
Master II
Master II
Author

Thanks for the help bro 🙂

Best Regards,
KC