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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

output a variable instead of a number inside a formula

Hi, I am looking to make a calculation spit out a variable instead of a number inside a summation formula - for example,

sum(

if(

isnull(ID), Revenue, NullRevenue, Revenue))


Ideally the output should be sum(Revenue) or sum(NullRevenue), but since if(isnull(ID), Revenue, NullRevenue, Revenue) spits out a number it ends up calculating sum(some numerical value). Any idea would be appreciated, thanks!

2 Replies
danieloberbilli
Specialist II
Specialist II

you can write a variable like this in the backend

LET vResult = '=sum(if(isnull(ID), Revenue, NullRevenue))';

MarcoWedel

if you like to get the strings 'sum(Revenue)' or 'sum(NullRevenue)' then you could try like:

='Sum('&If(IsNull(ID), 'NullRevenue', 'Revenue')&')'

hope this helps

regards

Marco