Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am relatively new to Qlik Sense, having started learning earlier this year.
I am having trouble with set analysis to calculate the sum for the prior YTD amount. I've tried several solutions that I've found on the forums here, but I'm still doing something wrong.
Very simply, my data has a BillDate dimension - loaded as "Date#(BillDate) as BillDate".There is a dollar amount for each of these BillDate records.
To get the YTD total for last year, I have been trying with the following expression:
SUM({$<BillDate = {'>=$(=Date(AddYears(YearStart(Today()),-1)))<$(=Date(AddYears(Today(),-1)))'}>}Amount)
But while the expression checker evaluates the set analysis correctly, I get 0 back every time.
I have tried using variables to get the dates, and using those variables in the set analysis - with the same result.
I have gone through date formatting, making sure my dates are all formatted the same across the app. The dates are the same format after my load, as they appear in the set analysis.
I'm at a loss and have somehow managed to kill most of my day with this.
Any suggestions are greatly appreciated!
You may have to format the date appropriately as it's sometimes interpreted differently. And use the modified expression below.
Date(BillDate,'DD/MM/YYYY') AS BillDate,
Sum({< BillDate ={">=$(=YearStart(Max(BillDate), -1))<=$(=AddYears(Max(BillDate), -1))"}>} Amount )
Try this Last YTD for the period selected
Sum({<Year=, Quarter=, Month=, Week=, BillDate ={‘>=$(=YearStart(Max(BillDate ), -1))<=$(=AddYears(Max(BillDate ), -1))’}>} Amount)
Thanks for your reply! I must be doing something wrong still. Qlik doesn't recognize "Quarter", and using any of the others still returns 0. I tried omitting the "Quarter" piece, and still get a 0 back.
The expression checker still evaluates the date range piece correctly.
I added a copy of my app, if that helps.
Perhaps this if you haven't derived time dimensions.
Sum({<BillDate ={‘>=$(=YearStart(Max(BillDate ), -1))<=$(=AddYears(Max(BillDate ), -1))’}>} Amount)
Still coming up with 0, I'll have to spend some more time with this and add time dimensions to the load script and try again. Thanks for your advice!!
Very simple app, trying to practice YoY, MoM measures with it - served its purpose though, because now I see what needs to be done.
You may have to format the date appropriately as it's sometimes interpreted differently. And use the modified expression below.
Date(BillDate,'DD/MM/YYYY') AS BillDate,
Sum({< BillDate ={">=$(=YearStart(Max(BillDate), -1))<=$(=AddYears(Max(BillDate), -1))"}>} Amount )
That did it! Thanks so much for your help!!!!!