Skip to main content
Announcements
Happy New Year! Cheers to another year of collaboration, connections and success.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggregating dimension based on Max month

I have a table in the format

Emp IDRoleMonthAmount
102001Line Manager1100
102001Line Manager2140
102001Line Manager3220
102001Line Manager4120
102001Program Manager5230
102001Line Manager6120
102001Line Manager7100

When I create a straight table in qlikview. i get the following output

Emp IDRoleAmount
102001Line Manager800
102001Program Manager230

But my requirement is to get total amount for an employee irrespective of his Role and ideally Role should be what is there in current month.

1. If i have not selected any month my role will be Line Manager (for July) and total amount will be 800+230=1030

Output:

Emp IDRoleAmount
102001Line Manager1030

2. If i have selected Jan-May, role will be Program Manager and Amount will be sum(amount) form Jan-May.

Output:

Emp IDRoleAmount
102001Program Manager810

So i should get only one record for the employee even if i have Role in dimension.

Any suggestions how can i do this ?

Thanks,

Sumit

3 Replies
rubenmarin

Hi Sumit, check attachment.

Expression for Role: only({<Month={$(=Max(Month))}>} Role)

Expression for Amount: Sum({<Month={"<=$(=Max(Month))"}>} Amount)

PradeepReddy
Specialist II
Specialist II

Try something like this...

Role : only({<Month={$(=Max(Month))}>} Role)

Amount : sum({<Month={'>= $(=min(Month)) <=$(=max(Month))'}>}Amount)

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Since you will be using an expression for the Role column, the other expression for Amount can revert back to:

=sum(Amount)

since Sumit specified that he will sum only those months that are explicitly selected...