Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Black_Hole
Creator II
Creator II

Display the data of the current month

Hello all,

I try to display the data of the current month from my straight table using only "expression".

So, I wrote the following expression:

=if(MonthName(addmonths(today(),-1))<=DATE,Custom)

But, my criteria is not considered.

Please could you advise me how I can display only the data from the current month using expression.

Thank you in advance for your help.

Labels (2)
11 Replies
Black_Hole
Creator II
Creator II
Author

Hello all,

Anyone to help me to resolve this request ??

Thank you in advance for your help.

Anonymous
Not applicable

can you describe your problem more in detail?

does your  table is empty (no rows?) or does it shows "-" in Custom column or does it show all rows?
The date format of monthname(....) and DATE are identical?

your expression would deliver all data from begin of previous month upto today (if expression would work)
if you want only data from current month, I would use monthstart instead of addmonths

Black_Hole
Creator II
Creator II
Author

Hello @Anonymous ,

Thank you for your reply.

My problem is that my expression displays all the rows (it's like the filter date is not considered). 

I hope it's more clear.

Thank you in advance for your help.

Anonymous
Not applicable

check if the expression =if(MonthName(addmonths(today(),-1))<=DATE (put it in a textobject) 
works for single data. select one row (one DATE) and see if the condition is true

Black_Hole
Creator II
Creator II
Author

Hello @Anonymous ,

I try it.

But, I should precise the date thanks to a listbox.

However, I would like to display directly the count of the data of the current month without specifying the date.

Below, my current configuration to display the count of data in the current month:

v2.PNG

Please could you tell me if it's possible that my expression count automatically the data for the current month without specifying each time the date.

Thank you in advance for your help.

Anonymous
Not applicable

you need to use set analysis, if you want ALWAYS the count of the current month independant from date selection (even if no date was selected)

count({<Month={$(=date(today(),'YYYY-MM')}>}yourfield)

Black_Hole
Creator II
Creator II
Author

Re @Anonymous ,

I try your solution but in my graph, I have a message saying "No data to display"

I'm not sure but maybe I should create the variable Month in my script.

Have you created the variable Month in your Editor Script ?

Thank you in advance for your help.

Vegar
MVP
MVP

I'm trying to understand your issue. Maybe you can do something like this. The expression used in the pie chart is in the bluegreen text box. See attached qvw file.

image.png

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Anonymous
Not applicable

in the qvw from Vegar you need to adapt the expression to:

count({<YearMonth= {"$(=date(today(),'MMM YYYY'))"}>}Answer)
will show you always the current month (today may numbers, next week june numbers)

The format I told earlier was different as I saw now MMM YYYY instead of YYYY-MM as shown in listbox