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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using variables in expressions

Hi,

Can anybody please help me?

Due to a system upgrade, I need to consolidate sales data from two sources, "Old Sales Data" and "New Sales Data".

Simply loading both as "Sales" in my load script causes problems.

I've created a variable, $(Total Sales), being the sum of "Old Sales Data" plus the sum of "New Sales Data", which works fine.

The following expressions:

Sum (if (InMonth (Date, Today(), 0), [Old Sales Data])) and Sum (if (InMonth (Date, Today(), 0), [New Sales Data]))

also work fine.

I now want to use the same expression using my Total Sales variable, something like  Sum (if (InMonth (Date, Today(), 0), $(Total Sales))), but cannot get it to function.

Sum (if (InMonth (Date, Today(), 0), [Old Sales Data])) + Sum (if (InMonth (Date, Today(), 0), [New Sales Data])) is the only way I have so far been able to return the value I require. This seems to be unnecessarily cumbersome. If I can use the variable then changing nearly a hundred expressions in my file can be simply achieved with the expressions editor, rather than a laborious longhand process.


Any help or suggestions on alternative management would be much appreciated.


Thank You.

Labels (1)
0 Replies