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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kdstrin1
Contributor II
Contributor II

Using Variable in Expression

Hello,

I am trying to sum volumes using a variable indicating the current fiscal month. The variable is set up as;

LET vMonthNumber=IF(Month(Today())='Apr',7);

My expression that I'm trying to get to work is;

Sum({$<YearDimension={'CurrentYear'},MetricDivision={'Cardiology'},FiscalMonthNBR=vMonthNumber>}[CompletedAppointments.Volume])

I can see the values of Fiscal Month NBR and vMonthNumber in a table and they seem to match (show numerical values), but my table using the expression 0's out the volumes. It seems the FiscalMonthNBR and vMonthNumber don't link to each other. If i change the expression to FiscalMonthNBR={'7'}, it works;

I'm looking for a way to call the variable into the expression so that the current month's values are displayed.

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi, If you want to use the month number of 3 months since today, you can use:

LET vMonthNumber=Num(Month(AddMonths(Today(),3)));

And use it as FiscalMonthNBR={$(vMonthNumber)}

 

View solution in original post

2 Replies
rubenmarin

Hi, If you want to use the month number of 3 months since today, you can use:

LET vMonthNumber=Num(Month(AddMonths(Today(),3)));

And use it as FiscalMonthNBR={$(vMonthNumber)}

 
kdstrin1
Contributor II
Contributor II
Author

={$(vMonthNumber)} was what I needed! Thank you very much!

 

 
Opens in new window
PDF Download
Word Download
Excel Download
PowerPoint Download
Document Download