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: 
Not applicable

How to compare two expressions with different values ​​of the same field

Hello

I have a problem making comparisons in a simple table. I need to compare data from two selections from the same field.

1. This is my first expression: sum({<YEAR={$(=Max(YEAR))}>}Amount)

I have the month short name field (called MONTH_SHORT_NAME) as a filter, if the user selects any month or months should sum the amounts for that month or months.

2. I need another expression to sum the amounts of other selection of any month short name. Something like this: sum({$<YEAR={$(=Only(YEAR_2))}, MONTH_SHORT_NAME={$(=MONTH_SHORT_NAME_2)}>}Amount)

I created a field outside the model to collect the month short name value (called MONTH_SHORT_NAME_2):

T_MONTH_2:

LOAD Distinct MONTH_SHORT_NAME AS MONTH_SHORT_NAME_2

Resident LkCalendar;

I need to make comparisons between both.

Any ideas?

Thanks for all.

1 Solution

Accepted Solutions
wms_manis
Partner - Contributor III
Partner - Contributor III

Take a look at alternate states.  Assign  Month field to two states and then use a reference to each state for comparison.

The WhatsNewinQlikView11.qvw has some examples.

Look at the product grouping tab.

View solution in original post

2 Replies
wms_manis
Partner - Contributor III
Partner - Contributor III

Take a look at alternate states.  Assign  Month field to two states and then use a reference to each state for comparison.

The WhatsNewinQlikView11.qvw has some examples.

Look at the product grouping tab.

Not applicable
Author

Thanks for your answer... its works!!

Regards.