Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'd like to use a variable inside a set analysis expression. Is it possible?
I have tried to use this expression, unsuccessfully:
sum({$<Year = {$(=only(Year))}, Month = {"<=SelectedMonth"}>} DaysNumber), where SelectedMonth is a variable.
Thanks
sum({$<Year = {$(=only(Year))}, Month = {$(=$(VariableName))}>>} DaysNumber).
sum({$<Year = {$(=only(Year))}, Month = {$(=$(VariableName))}>>} DaysNumber).
Hi,
You should always use the $ sign and the brackets to expland the variable. I hope this helps... please post the QV document, if you still have problems.
Also please see the below post on variables expansion used as UDF (user defined function). I thought you might be interested...
http://community.qlik.com/forums/t/43601.aspx
Hi, thanks.
Is it right also writing sum({$<Year = {$(=only(Year))}, Month <= {$(=$(VariableName))}>>} DaysNumber)?
I have added Month <= ... instead of Month = ...
Thanks
yes this will work fine
mmhhh, when I add the minor sign ( < ) in the expression editor I can see the text " <= " underlined in red. This is a mistake!
Thanks
Hi
This is, I think, the expression you are looking for:
sum({$<Year = {$(=only(Year))}, Month = {"<=$(=$(VariableName))"}>>} DaysNumber)
or (I think the outer dollar expansion may be unnecessary) ...
sum({$<Year = {$(=only(Year))}, Month = {"<=$(VariableName)"}>>} DaysNumber)
Hope that helps
Jonathan
Please can you post the QV document with sample data? It will be much easier to identify...