Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I 'm changing an existing app were we have a lot of almost the same content within our variables.
There is a computations which calculates the total cost increase/decrease for a certain region (4 regions in total) against a given reference period.
Each computation is displayed therefore there are 4 variables.
General formula is something like:
((ReportingYear) - (Reference period)) / (Reference period)
Each part in the above formula is given by the next part (Just changing Country code or Zone or the Year:
sum(
{$<
DimLocation.Country = {'....'}
, DimLocation.Zone = {''}
, DimCalendar.Year = {"$(=UV_ReportingYear)"}
, .... // Extra filtering that is constantly the same.
>}
Cost )
Depending on the region we use Country or Zone. (In country there is also a list that is used = "BE","NL", "FR", "DE")
I know I can split up the main parts of the formula in different variables to reuse them but it makes the amount of variables grow very big and makes is messy to do a little change.
Instead I would like to use some kind of dynamic function to give the changing parts as parameter.
((
$(ComputeCost("DimLocation.Country = {'BE','NL','DE,'FR'}", '$(uv_ReportingYear)'))
- $(ComputeCost("DimLocation.Country = {'BE','NL','DE,'FR'}", '$(uv_ReportingYear -1)'))
)/ $(ComputeCost("DimLocation.Country = {'BE','NL','DE,'FR'}", '$(uv_ReportingYear -1)'))
Is something like this possible in Qlik?
How is this possible?
Variables with parameter are possible and even the nesting of variables - whereby the last could become quite complicated because each comma is always treated as parameter-delimiter which couldn't be masked else only bypassed with doubled replacing-approaches or syntax which avoids the commas. So be careful not to make simple things more complex as sensible.
A parametrized variable may look like:
var:
$1({$2 < $3 = {$4}>} $5)
and called:
$(var(sum, $, Country, ("BE"|"NL"), Cost))
Variables with parameter are possible and even the nesting of variables - whereby the last could become quite complicated because each comma is always treated as parameter-delimiter which couldn't be masked else only bypassed with doubled replacing-approaches or syntax which avoids the commas. So be careful not to make simple things more complex as sensible.
A parametrized variable may look like:
var:
$1({$2 < $3 = {$4}>} $5)
and called:
$(var(sum, $, Country, ("BE"|"NL"), Cost))