Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
j_nlucas
Partner - Contributor III
Partner - Contributor III

Two expressions with two dates in set analysis not working

Hi

I've got a pivot table with dimensions: Week and Weekday for a selected year. I have to show the sales for each week and week day for the selected year, and for the previous year. 

I've got a calendar that gives me the fields week number and weekday and a fact table with the sales. In the calendar, for each date I also have the same date for the same week and weekday for the previous year. 

I can get it work for the current year, but when I write the expression for the last year, I get 0 for all. 

Expression for current year: sum(ImporteSinIVA)

Expression for last year: Sum({<Año, Mes, Trimestre, DiaSemana, Semana, Fecha, MismoDiaAA={'$(vMismoDiaAA)'}>}ImporteSinIVA).

Here, variable vMismoDiaAA = Date(Max(MismoDiaAA), 'DD/MM/YYYY'). The field "MismoDiaAA" is in the calendar, and it's calculated for each day, as stated above.  The variable is defined with the sign "=" at the beginning. 

I have attached the table should it help. 

 

Any idea? 

 

 

 

 

Labels (2)
4 Replies
hopkinsc
Partner - Specialist III
Partner - Specialist III

Hi, does it work if you use an = in the variable in the set analysis (before the varibale name)..

MismoDiaAA={'$(=vMismoDiaAA)'}>}ImporteSinIVA)

?

Wlad_Masi
Employee
Employee

Have you checked this link?
https://community.qlik.com/t5/Qlik-Design-Blog/Quotes-in-Set-Analysis/ba-p/1471824

Double quotes looks to be a good option here.
To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.
j_nlucas
Partner - Contributor III
Partner - Contributor III
Author

Hi Hopkinsc, thanks for your reply.
Unfortunately it doesn't work. However
Sum({<Año, Mes, Trimestre, DiaSemana, Semana, MismoDiaAA={"=$(vMismoDiaAA)"}>}ImporteSinIVA) will show the me same amount as the current date.

As you see, I have now changed the single quotes to double quotes, and added the = at the left of the "$". But I'm not there yet
j_nlucas
Partner - Contributor III
Partner - Contributor III
Author

Thank you for that link.

I downloaded the latest version and tried the double quotes, but it's not working.