Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
mellerbeck
Creator II
Creator II

Using an expression defined in a table

Given a table that has a metric and a goal, and two other tables that contain some data to compute against

Lets say for metric A I need data from results A and for metric B I need data from result B

So, I am able to do this with an if statement. Something like

if(Metric = 'A',

sum(A_Measure1) / sum (A_Measure2),

if(Metric = 'B',

sum(B_Measure1) / sum (B_Measure2)))

I'm trying to figure out if there is a way to more dynamically do this instead of a huge if statement.

Maybe have the metric table have the expression embedded somehow?

Or at least a match statement of some sort?

2 Replies
sunny_talwar

A solution with pick and match could be this:

=Pick(Match(Metric, 'A', 'B'), sum(A_Measure1) / sum (A_Measure2), sum(B_Measure1) / sum (B_Measure2))

mellerbeck
Creator II
Creator II
Author

So in trying to make it more dynamic I concatenated all the metric name and metric definitions into variables and used them in the pick and match. Still wish there was a way to do this more built in...