Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like advice on Set analysis and variable in Load statement. I searched the community for a similar problem, but I couldn't find anything that would help me.
The idea is that I would like to insert the string (Set analysis) into a variable in the Load statement and then use it in an expression (for example a pivot table). In the attached QV example I put it in a Text object for the simplicity now.
However, calculating "set analysis = > count DATE lines per YEAR does not work for me:
=count({$<DATE={"$(=Date(MakeDate(GetFieldSelections(YEAR),1,1),'D.M.YYYY'))"}>} YEAR)
a simple line with the constant: year = 2023 looks like this:
= count({$<DATE={2023}>} YEAR)
I think there is a problem with the GetItemSelections() when I SET it in the variable.
The resulting value is 0 and the result should be equal to 3 for year 2023.
I checked whether the same Set analysis entry works correctly, but by writing it directly (without a variable) into the text object as an expression - it works fine there, the result is correct = 3 for year 2023 (2 for year 2022, 1 for year 2021)
Please advise me how to write correctly the variable in the load statement?
Thanks.
Peter
I found a link to another article that has a workaround by loading from an excel file ..
https://community.qlik.com/t5/QlikView-Documents/Managing-Variables/ta-p/1495738
Here is the problem. This is what is stored in the variables:
Thanks Lisa for your reply,
yes, you're right - that's a problem in the variable where the date function is defined = Date(MakeDate(GetFieldSelections(YEAR),1,1),'D.M.YYYY')
the variable that gets into the expression is = count({$<DATE={""}>} YEAR)
where I would like the date (defined formula) to be written there instead of ""
Please, does anyone know a trick how to write this variable correctly?
I spend a lot of time testing but still no solution 😞
I found a link to another article that has a workaround by loading from an excel file ..
https://community.qlik.com/t5/QlikView-Documents/Managing-Variables/ta-p/1495738
Thank you Lisa, very good suggestion to solve my problem...