Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi! I need a help.
Data (example):
Object | Manager | Appointment_date_manager |
---|---|---|
1 | Ivanov | 28.04.2016 |
1 | Petrov | 30.11.2017 |
1 | Sidorov | 10.09.2018 |
2 | Kuznetsov | 11.09.2018 |
3 | Petrov | 20.09.2018 |
3 | Kiselev | 21.09.2018 |
4 | Sidorov | 11.11.2016 |
4 | Kiselev | 20.04.2017 |
4 | Ivanov | 20.08.2018 |
5 | Sidorov | 20.09.2018 |
6 | Ivanov | 11.12.2017 |
What i need in a result (object's quantity of current manager):
Manager | Quantity of objects |
---|---|
Ivanov | 2 |
Petrov | 0 |
Sidorov | 2 |
Kuznetsov | 1 |
Kiselev | 1 |
Thanks for your ideas
You can flag the current managers in the script, but since you were calling for Aggr in the title, I guess you want a chart based solution, e.g.
Manager | Sum(Aggr(If(Manager = FirstSortedValue(Total<Object> Manager, -Appointment_date_manager),1,0), Object, Manager)) |
---|---|
6 | |
Ivanov | 2 |
Kiselev | 1 |
Kuznetsov | 1 |
Petrov | 0 |
Sidorov | 2 |
Can you expand on logic behind the second table
I'm assuming the Quantity of objects column in your example is based off a date range (using field Appointment_date_manager)?
You can flag the current managers in the script, but since you were calling for Aggr in the title, I guess you want a chart based solution, e.g.
Manager | Sum(Aggr(If(Manager = FirstSortedValue(Total<Object> Manager, -Appointment_date_manager),1,0), Object, Manager)) |
---|---|
6 | |
Ivanov | 2 |
Kiselev | 1 |
Kuznetsov | 1 |
Petrov | 0 |
Sidorov | 2 |
Or using the script flag:
INPUT:
LOAD Object,
Manager,
Appointment_date_manager
FROM
[https://community.qlik.com/thread/314984]
(html, codepage is 1252, embedded labels, table is @1);
DATA:
LOAD Object,
Manager,
Appointment_date_manager,
If(Previous(Object)<>Object,1,0) as Current
Resident INPUT
Order by Object, Appointment_date_manager desc;
DROP TABLE INPUT;
and in the UI
Manager | Sum(Current) |
---|---|
6 | |
Ivanov | 2 |
Kiselev | 1 |
Kuznetsov | 1 |
Petrov | 0 |
Sidorov | 2 |
Thanks a lot! That's really what i need.