Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why these two expressions act differently?

Greetings all,

I have two expressions to calculate MTD sales:

for example these values will be selected by the user : Year=2014, Month=Jun, Day=22

Exp1:

sum({<Year={$(vL.CurrentYear)},Month={$(vL.CurrentMonth)},CreatedDate={'<=$(vL.CurrentDate))'}>}Price)

Exp2:

sum({<Year={$(vL.CurrentYear)},Month={$(vL.CurrentMonth)},Day={'<=$(vL.CurrentDay)'}>}Price)

CreatedDate is my link date field between Sales fact table and my master calendar.

while Exp2 gives the expected result,  Exp1 only bring the values of the 22nd of June whereas it should cover all the days of the month because of the "<=" sign in the expression.

could anyone please points out to me what I am doing wrong in Exp1?

6 Replies
Not applicable
Author

Hi Ali ,

According to you CreatedDate field link between MasterCal & Sales So,in this case if CreateDate format is not matching with your selection it will reflect all values instead of selection.

Just check your format whether is is in proper date format or not.

Regards,

Harshal

michael_maeuser
Partner Ambassador
Partner Ambassador

you have one ) too much in the first expression

sum({<Year={$(vL.CurrentYear)},Month={$(vL.CurrentMonth)},CreatedDate={'<=$(vL.CurrentDate))'}>}Price)

maybe that´s why

Not applicable
Author

No that was not it.

Not applicable
Author

the format is the same

CreatedDate.PNG.png

Not applicable
Author

Hi Ali,

Try this,

sum({<Year={$(vL.CurrentYear)},Month={$(vL.CurrentMonth)},CreatedDate={'$(vL.CurrentDate)-1)'}>}Price)

Not applicable
Author

I think this only sets the CreatedDate to one day before.  it does not calculate MTD.