Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
azmeerrehan
Partner - Creator
Partner - Creator

Current Month Issue

I am trying to show the Month to Date number for the month today.  So If its June today, I would like to show the data for Jun only.  My data is a MTD data, so I have created a variable (vMonthToday=Num(Month(Today()))) and My expression is

sum({<Month = {$(=vMonthToday)}>}  Sales), it works perfectly fine for YTD with this expression

sum({<Month = {"<=$(=vMonthToday)"}>}  Sales).

So I would like to show only Month(Today) data . I expect to see 2017 Jun = 2315 only and not the cumulative.

Attached please find the sample

1 Solution

Accepted Solutions
Anil_Babu_Samineni

I don't have Qlikview software. Does Month field has number values rather month names. Could be miss behaviour over month field? Check from your end

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

7 Replies
Anonymous
Not applicable

Try expression as below

sum({<Month = {"$(vMonthToday)"}>}  Sales)

azmeerrehan
Partner - Creator
Partner - Creator
Author

Doesnt work, already tried that

Anil_Babu_Samineni

I don't have Qlikview software. Does Month field has number values rather month names. Could be miss behaviour over month field? Check from your end

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
lironbaram
Partner - Master III
Partner - Master III

hi

your problem that the month field isn't numeric but text , and the your variable was numeric

i prefer to have a field motnhyear with the first date of the month as the value

then it's esayier to work have a look at the attach example

it better to use mothyear field because month alone isn't good enough because it only work if you have one year of data

Anonymous
Not applicable

Ofcourse you need to change variable to have string of month and not the number to make above expression work.

Thanks

kennethmash
Contributor III
Contributor III

!Hi Rehan

Try the attached sample. Your Month is not numeric which is what is causing the problem

Anonymous
Not applicable

You Can Try This Formula's

Last Month to-date =sum({<Year= {'$(=max(Year)-1)'},Month={'$(=month(Today()))'}>}Sales)

Current Month to-date  =sum({<Year= {'$(=max(Year))'},Month={'$(=month(Today()))'}>}Sales)

Last Year to Date = =sum({<Year={'$(=max(Year)-1)'},Month ={'<=$(=num(month(Today())))'}>}Sales)


Current Year to Date= sum({<Year={'$(=max(Year))'},Month ={'<=$(=num(month(Today())))'}>}Sales)