Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

help with set analysis

Hi  i am working on set analysis for lastyear mtd values

i am calculating with variables

below are my variable declaration

for

LastYearMonthStart (vMnthStartLY) : =Date(MonthStart(AddMonths(Max(CalDate),-12)),'DD/MM/YYYY')

LastYearMonthToDate (vLyMtd) :=Date(Max(CalDate)-364,'DD/MM/YYYY')



below is my set Expression

Sum({<CalDate={'>=$(vMnthStartLY) <=$(vLyMtd)'}>}LY_DAY_NET_SALES)


the above set expression is giving zero values between dates in the variable but when i hard code particular dates it is giving correct results .

but my variables used in the set expresiiion are also giving the correct dates .

please fnd the attachment

Any help is appreciated

Thanks




16 Replies
avinashelite

Try with double Quotes

Sum({<CalDate={">=$(vMnthStartLY) <=$(vLyMtd)"}>}LY_DAY_NET_SALES)

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Do those variables contain the right-hand expression itself, or do they contain the result of the expression?

MK_QSL
MVP
MVP

Create tow variables in Variable Overview as below

vMnthStartLY

Date(MonthStart(Max(CalDate),-12))

vMnthEndLY

Date(MonthEnd(Max(CalDate),-12))


Make sure that in Variable definition you should not use = in front of any Variable expression


Now use below expression

=SUM({<CalYear= , CalMonth = , CalDate = {">=$(=$(vMnthStartLY))<=$(=$(vMnthEndLY))"}>}LY_DAY_NET_SALES)

settu_periasamy
Master III
Master III

What about your CalDate format?

For testing, remove the label for set expression and check it is showing correct date value

Anonymous
Not applicable
Author

variables contain result of the expression .

i have declared as below

vMnthStartLY =Date(MonthStart(AddMonths(Max(CalDate),-12)),'DD/MM/YYYY')


vLyMtd =Date(Max(CalDate)-364,'DD/MM/YYYY')




Anonymous
Not applicable
Author

I have already tried avinash but no luck

sunny_talwar

In addition may be try removing the space between your first variable and less than equal sign (<=)

Sum({<CalDate={">=$(vMnthStartLY)<=$(vLyMtd)"}>} LY_DAY_NET_SALES)

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Can you give an example of their current values? Does the formatting you are using in the Date() call match the default DateFormat setting?

Anonymous
Not applicable
Author

Hi Settu

i have tested it is giving correct values