Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
TomBond77
Creator II
Creator II

Current month not working

Hi experts

We are working with stock measures, non-cumulative. I need to see only the stock of the current month. The following formula doesn't work. It shows the YTD value, in our case January and February. I only need to see the stocks for February. This formula seens to be ineffective:

Sum({$<MonthNum={'$(=(MonthNum)today())'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

Any ideas?

Thanks

Tom

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

This should work,

be sure about the name of MonthNum or %MonthNum:

Sum({$<MonthNum={'$(=num(month(today(1))))'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

 

View solution in original post

10 Replies
NitinK7
Creator III
Creator III

Hi, 

Try below expression

Sum({$<MonthNum={'$(=Num(Month(today())))'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

micheledenardi
Specialist II
Specialist II

I believe MonthNum() is not valid function:

Try this:

Sum({$<MonthNum={'$(=num(month(today(1))))'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

 

TomBond77
Creator II
Creator II
Author

Thanks guys

Both proposals also don't work. Any more ideas?

Regards

Tom

micheledenardi
Specialist II
Specialist II

Which is the format of MonthNum? 2 or 02 ? Or something else?

micheledenardi
Specialist II
Specialist II

if is two digits 02 you can use this:

 

Sum({$<MonthNum={'$(=mid(today(1),4,2))'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

 

NitinK7
Creator III
Creator III

Hi

Monthnum(Highlighted in red) is your field?? , if yes then could please paste here value of monthnum field

 

Sum({$<MonthNum={'$(=(MonthNum)today())'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

 

 

TomBond77
Creator II
Creator II
Author

TomBond77_0-1614068311780.png

 

micheledenardi
Specialist II
Specialist II

This should work,

be sure about the name of MonthNum or %MonthNum:

Sum({$<MonthNum={'$(=num(month(today(1))))'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])

 

View solution in original post

NitinK7
Creator III
Creator III

make sure to passing % Monthnum or Monthnum 

or you can hide % sign using below set variable in script 

set HidePrefix='%';

then load your data 

and then try below expression 

Sum({$<MonthNum={'$(=Num(Month(today())))'}, [Product Unit]={'Cars','Bikes','Trucks'}>} [Total Stock])