If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.
i got a question, my data do look like:
Customer, Amount, ExpectedValue = Flag
Adam, 100, 1
Adam, 50, 1
Smith, 80, 2
Smith, 10, 2
Oliver, 90, 1
Oliver, 30, 1
my issue is, how can i create the flag on the base of aggregated values, for example
Amount of Adam is greater than 100 = 1
Amount of Smith is lower than 100 = 2
Amount of Oliver is greater than 100 = 1
i am using the function sum () and group by () and the Field: Flag gives for each line the value, i want to give the aggregated value for each customer.
does anybody have any idea, how to rectify this issue?
Thanks a lot
Thanks for your reply.
My previous comment will satisfy your scenario. If incase, you want to achieve by using Sum() & Groupby() function, below code will help you.
Test:Load * Inline [Customer, Invoice, Amount
Adam, 1212S, 100
Adam, 1214S, 50
Smith, 1516S, 80
Smith, 1515S, 10
Oliver, 2020s, 90
Oliver, 2021S, 30];
Temp_T2:Load Customer,Sum(Amount) as Tot_AmountResident Testgroup by Customer;
T2:LoadCustomer,if(Tot_Amount>100,'1','2') as FlagResident Temp_T2;
Drop Table Temp_T2;
Load * Resident Test;
Drop table Test;
**Confirm me, you're looking above result.
View solution in original post
Hope below expression works for you,
if(Amount>100,'1','2') as Flag
thanks a lot for your help and valuable time, i think i overlooked one point in this issue, my data do look like:
Customer, Invoice, Amount, ExpectedValue = Flag
Adam, 1212S, 110, 1
Adam, 1214S, 50, 1
Smith, 1516S, 80, 2
Smith, 1515S, 10, 2
Oliver, 2020s, 150, 1
Oliver, 2021S, 30, 1
i am using the function sum () and group by () and the Field: Flag gives for each line the value, i want to give the aggregated value for each customer like Adam = 1 and Smith 2.
I hope i could explain well enough, let me know if i overlooked something
Thanks a lot
Hi Pokaviyarasu, thanks a lot for your help and your valuable time