Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
khanashique
Creator II
Creator II

Set Expression Month Condition

Hi Experts,

I am facing an issue in the following looking numbers for last month, while adding the set expression in graph:

Dimension = Date

Measure = Sum({<Category = {'Books'},Month = {"$(=Month(Today())-1)"}>}OrderQty)

 

Thanks,

MAK.

Labels (2)
1 Solution

Accepted Solutions
pradosh_thakur
Master II
Master II

Hi @khanashique 

 

With your sample data this will work.

= Sum({<Category = {'Book'},DATE ={"=month(today()-30)=Month(DATE)"}>} OrderQTY)
Learning never stops.

View solution in original post

15 Replies
Channa
Specialist III
Specialist III

if you looking for last month

then  vMonth =$(vYearStart_Join)

 

 

Measure = Sum({<Category = {'Books'},Month = {"$(vMonth )"}, year ={"=year(today())"}>}OrderQty)

 

try this if you look for current year then 

 

Channa
khanashique
Creator II
Creator II
Author

I am looking for current year last month

Channa
Specialist III
Specialist III

ok

create variable

vYear= year(today())

 

Measure = Sum({<Category = {'Books'},Month = {"$(vMonth )"}, year ={"$(vYear)"}>}OrderQty)

 

 

Channa
Channa
Specialist III
Specialist III

if you have date in you date base

create these two variable

vMonthStart=monthstart(AddMonths(Today(),-1))

vMonthEnd=monthend(AddMonths(Today(),-1))

 

Measure = Sum({<Category = {'Books'},date ={">=$(vMonthStart)<=$(vMonthEnd)"}>} >}OrderQty)

 

if you have date it is better when you are in jan it will take to december last year

Channa
khanashique
Creator II
Creator II
Author

the above expressions/variable does not work.

I am sure with the below expression, but donno why its not working:

Measure = Sum({<Category = {'Books'},Month = {"$(=Month(Today())-1)"}>}OrderQty)

 

Channa
Specialist III
Specialist III

did you tri passing 

=Month(Today())-1

into variable

or else check your Month data format, may be in your DB you have month name

Channa
pradosh_thakur
Master II
Master II

hi @khanashique 

 

 

Your expression is good and shall work. Can you tell us how your month field looks like? What are the values? And When you say it is not working what is wrong ? A screenshot will help as well.

 

-Pradosh

Learning never stops.
khanashique
Creator II
Creator II
Author

Hi Pradosh,

 

 

khanashique
Creator II
Creator II
Author

Please see attached data