Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
kristof_j
Creator II
Creator II

New expression on every row

Hello

I need to make a a visualization with each line a new expression. That list of expressions need to be easily expanded and can potentially be big. That means we don't want a developer to change the object every time a new expression is needed.

I was thinking of storing expressions in a data island but I don't want to see the expression, I want to see the value of the expressions.
This is the view of the data island but I can't get the expressions to work.

kristof_j_0-1635861363858.png

So is this a good way to work?
If yes, do you know how to make this table to work?

Data I've used

 

data:
LOAD *
Inline [
client, product, amount, ic
a, product1, 540, 1
a, product1, 87, 0
a, product2, 987, 1
b, product1, 321, 1
c, product2, 456, 1
d, product3, 357, 1
e, product4, 195, 0
];

 

 

Expressions:
LOAD *
Inline [
ExpressionName, ExpressionNo, Expression, indent
Total, 7, sum(amount), 0
Total_0, 8, sum( {<ic = {'0'}>} amount), 1
Total_1, 9, sum( {<ic = {'1'}>} amount), 1
Product1, 10, sum( {<product = {'product1'}>} amount), 0
Product1_0, 11, 'sum( {<product = {'product1'}, ic = {'0'}>} amount)', 1
Product1_1, 12, 'sum( {<product = {'product1'}, ic = {'1'}>} amount)', 1
];

 

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

That's the easiest way i found:

data:
LOAD *
Inline [
client, product, amount, ic
a, product1, 540, 1
a, product1, 87, 0
a, product2, 987, 1
b, product1, 321, 1
c, product2, 456, 1
d, product3, 357, 1
e, product4, 195, 0
];

Expressions:
LOAD *,
	RecNo() 		as SortOrder
Inline [
ExpressionName, ExpressionNo, Expression, indent
Total, 7, sum(amount), 0
Total_0, 8, sum( {<ic = {'0'}>} amount), 1
Total_1, 9, sum( {<ic = {'1'}>} amount), 1
Product1, 10, sum( {<product = {'product1'}>} amount), 0
Product1_0, 11, 'sum( {<product = {'product1'}, ic = {'0'}>} amount)', 1
Product1_1, 12, 'sum( {<product = {'product1'}, ic = {'1'}>} amount)', 1
];


ExpressionsTemp:
Load 
	Concat(Expression,',',SortOrder) as [Concat Expression]
Resident Expressions Group By 1;

let vMeasure=peek('Concat Expression',0,'ExpressionsTemp');
Drop Table ExpressionsTemp;

Then setup your table with following expression:

Pick(SortOrder,$(vMeasure))

And the result will be: 

2021-11-02 16_03_42-Qlik Sense Desktop.png

 

Attached you can find the QVF

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

1 Reply
micheledenardi
Specialist II
Specialist II

That's the easiest way i found:

data:
LOAD *
Inline [
client, product, amount, ic
a, product1, 540, 1
a, product1, 87, 0
a, product2, 987, 1
b, product1, 321, 1
c, product2, 456, 1
d, product3, 357, 1
e, product4, 195, 0
];

Expressions:
LOAD *,
	RecNo() 		as SortOrder
Inline [
ExpressionName, ExpressionNo, Expression, indent
Total, 7, sum(amount), 0
Total_0, 8, sum( {<ic = {'0'}>} amount), 1
Total_1, 9, sum( {<ic = {'1'}>} amount), 1
Product1, 10, sum( {<product = {'product1'}>} amount), 0
Product1_0, 11, 'sum( {<product = {'product1'}, ic = {'0'}>} amount)', 1
Product1_1, 12, 'sum( {<product = {'product1'}, ic = {'1'}>} amount)', 1
];


ExpressionsTemp:
Load 
	Concat(Expression,',',SortOrder) as [Concat Expression]
Resident Expressions Group By 1;

let vMeasure=peek('Concat Expression',0,'ExpressionsTemp');
Drop Table ExpressionsTemp;

Then setup your table with following expression:

Pick(SortOrder,$(vMeasure))

And the result will be: 

2021-11-02 16_03_42-Qlik Sense Desktop.png

 

Attached you can find the QVF

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.