# 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
Did you mean:
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
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])``

10 Replies
Creator III

Hi,

Try below expression

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

Specialist II

I believe MonthNum() is not valid function:

Try this:

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

Creator II
Author

Thanks guys

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

Regards

Tom

Specialist II

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

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])``

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])

Creator II
Author

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])``

Creator III

make sure to passing % Monthnum or Monthnum

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

set HidePrefix='%';