# Month as number for calculation

**URL:** <https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098>\
**Category:** Ask the Community\
**Created:** [July 1, 2019, 1:39am UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098 "2019-07-01T01:39:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeriel](https://avatars.discourse-cdn.com/v4/letter/j/6bbea6/32.png) [@Jeriel](https://pug.phocassoftware.com/u/Jeriel)\
**Post date:** [July 1, 2019, 1:39am UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098/1 "2019-07-01T01:39:14Z")

</div>

I am trying to create a report which use current month as period. I was wondering if there is a way to pick month convert it number for calculation. Does anyone tried it before?

Samples below

Current month CM = July  
CM = 7

Calculation  
Month Cover = 10 months volume / CM + 3

---

<div class="post-metadata">

**Author:** ![ShaneAngel](https://sea1.discourse-cdn.com/flex015/user_avatar/pug.phocassoftware.com/shaneangel/32/68_2.png) [@ShaneAngel](https://pug.phocassoftware.com/u/ShaneAngel)\
**Post date:** [July 1, 2019, 6:51am UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098/2 "2019-07-01T06:51:13Z")

</div>

Welcome to PUG @Jeriel.

I am unsure on answering your question directly, but maybe you can do a different calculation using the {period\_count} functionality in custom mode found on [this page](https://helpphocassoftware.atlassian.net/wiki/spaces/userdoc/pages/590045/Custom+mode)?

---

<div class="post-metadata">

**Author:** ![StuartH](https://sea1.discourse-cdn.com/flex015/user_avatar/pug.phocassoftware.com/stuarth/32/394_2.png) [@StuartH](https://pug.phocassoftware.com/u/StuartH)\
**Post date:** [July 1, 2019, 11:31am UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098/3 "2019-07-01T11:31:17Z")

</div>

Check out this thread, there is currently no system driven way to provide this, only way is to add a stream - but doing that gives more flexibility.

> [@Plan by working days vs sales](https://pug.phocassoftware.com/t/plan-by-working-days-vs-sales/872):
>
> Is there a way to build an automatically updating working day function? i.e. I’ve built a custom report that monitors sales vs plan but the plan is divided by number of working days in the month multiplied by number of days completed. Therefore shows sales vs a pro rata’d plan. Jan = 22 working days Friday 25th Jan was day 18 Jan plan total = 450,000 units Jan sales at 25th = 400,000 units Jan plan of 450,000 / 22 days \* 18 days = 368,182 vs sales of 400,000. So we are 31,818 units above p…

My stream is hopefully going to be as follows:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/phocassoftware/original/1X/a1f30bdc827e8bdf07f6c73c3d549fc0921245e4.png)

---

<div class="post-metadata">

**Author:** ![Jeriel](https://avatars.discourse-cdn.com/v4/letter/j/6bbea6/32.png) [@Jeriel](https://pug.phocassoftware.com/u/Jeriel)\
**Post date:** [July 2, 2019, 12:52am UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098/4 "2019-07-02T00:52:11Z")

</div>

Thanks

Regards,  
**Jeriel Gangoso**

---

<div class="post-metadata">

**Author:** ![janthony](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@janthony](https://pug.phocassoftware.com/u/janthony)\
**Post date:** [July 4, 2019, 11:34pm UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098/5 "2019-07-04T23:34:54Z")

</div>

Hi,

Aside from the {PERIOD\_DAYS}, there is a hidden gem where you can use case statements in Custom formulas. Below is an example where I need to get sales for the last weekday using a SQL function to drive the logic:

^CASE WHEN DATENAME(weekday,GETDATE()) = ‘Monday’ THEN {a} ELSE {b} END

{a} = sales for yesterday - 2  
{b} = sales for yesterday

You could do something similar if there are no better methods.

Cheers,  
John

---

<div class="post-metadata">

**Author:** ![Jeriel](https://avatars.discourse-cdn.com/v4/letter/j/6bbea6/32.png) [@Jeriel](https://pug.phocassoftware.com/u/Jeriel)\
**Post date:** [July 5, 2019, 1:18am UTC](https://pug.phocassoftware.com/t/month-as-number-for-calculation/1098/6 "2019-07-05T01:18:25Z")

</div>

thanks

Regards,  
**Jeriel Gangoso**
