Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
bwqlikview
Contributor II
Contributor II

12 rolling months Summary From Current month

I am looking for some help on restricting a chart to display the recent 12 month's data. Testing data is attached. and set expressions are pasted below:

Dimension:

BU

Boiler


Expressions:

Sum({<YearMonth = {">=$(=Date(addmonths(Today(), -12), 'MMM YYYY')) <=$(=Date(addmonths(Today(), 0),  'MMM YYYY'))"} >} Hours)

I did not receive any error, neither data.

Thank you in advance for your time and effort

Beth

1 Solution

Accepted Solutions
sunny_talwar

I think the problem might be that your YearMonth field is not read as a date field... I get this

Capture.PNG

When I use this script

Table:

LOAD BU,

    Boiler,

    Hours,

    Date(Date#(MonthYear, 'MMM YYYY'), 'MMM YYYY') as MonthYear,

    Date(Date#(YearMonth, 'MMM YYYY'), 'MMM YYYY') as YearMonth

FROM

[..\..\Downloads\TestingData.xls]

(biff, embedded labels, table is Sheet1$);

View solution in original post

5 Replies
sunny_talwar

I think the problem might be that your YearMonth field is not read as a date field... I get this

Capture.PNG

When I use this script

Table:

LOAD BU,

    Boiler,

    Hours,

    Date(Date#(MonthYear, 'MMM YYYY'), 'MMM YYYY') as MonthYear,

    Date(Date#(YearMonth, 'MMM YYYY'), 'MMM YYYY') as YearMonth

FROM

[..\..\Downloads\TestingData.xls]

(biff, embedded labels, table is Sheet1$);

bwqlikview
Contributor II
Contributor II
Author

Thank you for your reply.

YearMonth could be an issue, but if i change my expression and let

YearMonth = {"$(=Date(addmonths(Today(), -12), 'MMM YYYY'))

it works fine.

sunny_talwar

Because for a single month you are able to compare the text to text... but for a range, you cannot compare text to a range... for that you need to compare a number to a range.

bwqlikview
Contributor II
Contributor II
Author

Thank you for your time and effort, it helps!

sunny_talwar

No problem at all. If you got what you wanted, please close the thread down.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny