Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
gines_rueda
Contributor III
Contributor III

Add expressions dynamically in a table

Hi,

To keep you in the loop, I have a table with:

1 Dimension (Currency)

10 Expressions (Different kind of amounts)

I am creating expressions to do some calculations agains that values per currencie (sum, deduct)

What I need is "to split 1 expression in severals(the number of splits is dinamically provided by a field) according to a related field with that amount, but just 1 of them".

For example: lets call "INCOME" one of that expressions, that is SUM(Income Amount), I need to be able to split this with a field "Income Type" in X different expressions.

I can't use dimensions because this don't apply to all the expressions.

I was looking for something that could add expressions dinamically with a trigger or macro after the load, but all solutions are welcome.

Let me know what you think.

Thanks.

Ginés.

1 Reply
gines_rueda
Contributor III
Contributor III
Author

Hi again,

The only solution I have found for this is:

1 - Create a field called Table Dimensions that has the values known of the rows inserted inline and the ones I only can check from an extract. Something like this:

Load * inline

[

  Table Dimensions

  Dimension known 1

  Dimension known 2

];

OUTER JOIN

LOAD Distinct

     Value AS [Table Dimensions]

;

2 - Then having in 1 field all the "Expressions" I want for my table, what I have done is the creation of a pivot table where as columns I have my Currency dimension, and for the rows I have this dimension.

3 - Create only 1 expression with a huge switch case:
pick(1+match(MyField,'Case 1','Case 2'),Default,Result1,Result2).


If you find a better way to do this, please let me know.

Regards.

Ginés.