Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
ramp1985
Contributor II
Contributor II

If dimension is equal to 'city', then

Hi all,

I have a table:

City                  Sales 2021                  budget

London           123

Berlin               456

Paris                 234

I want to "fill" out the budget column, saying:

If([City]='London',200000,[City]='Berlin',3000000 and so on.

My issue is that the City column is not a dimension, but its a column created on another dimension. The formula in the city column is:

If(Match([location], 'A', 'B', 'X'), 'London',
If(Match([location], 'E', 'F'), 'Berlin',
If(Match([location], 'G', 'H'), 'Paris')))

How to Proceed to make an If statement on that field?

Labels (2)
4 Replies
JuanGerardo
Partner
Partner

You can use column() function, for example If(Column(1) = 'London', 1, etc.

Anyway, I would recommend to create the City field in the script to simplify your UI logic and expressions.

JG

ramp1985
Contributor II
Contributor II
Author

Hi again,

Thanks for your reply.

I can see I posted wrong, the table is a Pivot Table.

Tried the column() function, but only  seems to work on expressions?

Btw. I dont have access to change in the script.

JuanGerardo
Partner
Partner

I thought it was a measure. Then I thing you will have to replicate the same logic:

If(Match([location], 'A', 'B', 'X'), 10,
If(Match([location], 'E', 'F'), 20,
If(Match([location], 'G', 'H'), 30)))

JG

ramp1985
Contributor II
Contributor II
Author

Hi again,

Works if I place it as a new row, but I need it as a measure to use these values to calculate deviation between sales and budgets.?