
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Count of Current Month vs Previous Month
Hi All,
I have the following data:
Code | Date(MM/DD/YYYY) |
ABC | 1/19/2014 |
DEF | 2/15/2014 |
XYZ | 2/20/2014 |
HIJ | 3/25/2014 |
PQR | 3/27/2014 |
RST | 3/30/2014 |
I need to find the Count of Code for March v/s Feb.
I used the following variables:
vCurrentMonth =MonthName(Today())
vPreviousMonth = Date#((vCurrentMonth -1),'MMM-YYYY')
I am unable to find the count of Code for the above data.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using calculated dimension in pivot table like
=if(MIxMatch(MONTH(SALEDATE),month(today()),month(monthstart(today())-1)),MONTH(SALEDATE))
and the Expression = Count(CODE)


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this set of expression
Count({<DateField={">=$(=MonthStart(Today()))<=$(=Today())"}>} Code) for Current month count
Count({<DateField={">=$(=MonthStart(Today(), -1))<=$(=Date(Floor(MonthEnd(Today(), -1))))"}>} Code) for Previous month count.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try like:
vPreviousMonth = MonthName(AddMonths($(vCurrentMonth), -1))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please check enclosed file...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I did get my Current Month and Current Month -1 answer correct, however I would like to know can I get CurrenMonth and CurrentMonth-1 field as dimension.
As I want to develop a chart for this two dimensions only.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Two ways:
- Calculate one additional column as PreMonth in the script.
- Synthetic dimension using ValueList() in the front end.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a straight table with
Month as dimension and
Expressions as below...
For Current Month
Label
=Month(Today())
Expression =
COUNT({<Month = {'$(=Month(Today()))'}>}Code)
For Previous Month
Label
=SubField('$(MonthNames)',';',Month(Today())-1)
Expression
COUNT({<Month = {"$(=SubField('$(MonthNames)',';',Month(Today())-1))"}>}Code)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using calculated dimension in pivot table like
=if(MIxMatch(MONTH(SALEDATE),month(today()),month(monthstart(today())-1)),MONTH(SALEDATE))
and the Expression = Count(CODE)

.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Hitesh,
Please find attached file for solution.
Regards,
Jagan.
