Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to apply a variable to specific values in a table?

Hello -

I created a simple chart based on the data in the following format: 

MarketYearSales
Austria2008           1,800
Austria2009           2,000
Austria2010           2,220
Austria2011           1,750
Belgium2008         20,000
Belgium2009         23,000
Belgium2010         24,000
Belgium2011         21,250

In this example, the sales numbers from 2008-2010 are reported in USD, and the 2011 totals are in Euro.  I need to get the 2008-2010 values equivalent to a Euro currency.  I created a variable called "FX Rate" (where FX rate = value from 1.0 to 1.6) and made this simple expression:  Sum (Sales)/[FX RATE].  However, I need to apply this ONLY to values where Year = 2008,2009,2010 (or less than 2011).  How would I do this?  Attached is the example.  Thanks for the help.   

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Hi,

I'd prefer to create a table with at least year and the Fx rate.

If you prefer to kind of hardcode the rule, you can use set analysis to segment in two sums:

(Sum ( {<Year={"<2011"} >} Sales)/[FX RATE]) +

Sum ( {<Year={">=2011"} >} Sales)

The first part, divides the results before 2011 by Fx Rate.

The second part just sums the values since 2011

Hope it helps,

Erich

View solution in original post

2 Replies
erichshiino
Partner - Master
Partner - Master

Hi,

I'd prefer to create a table with at least year and the Fx rate.

If you prefer to kind of hardcode the rule, you can use set analysis to segment in two sums:

(Sum ( {<Year={"<2011"} >} Sales)/[FX RATE]) +

Sum ( {<Year={">=2011"} >} Sales)

The first part, divides the results before 2011 by Fx Rate.

The second part just sums the values since 2011

Hope it helps,

Erich

Not applicable
Author

Awesome, thanks Erich - works perfectly.