2 Replies Latest reply on May 4, 2018 9:02 AM by Swapna Pothabathula

# How to get previous month sales on the first of current month and month to date sales otherwise - 10.5

Hi everyone - I am having trouble to create a calculated field that gives sum of previous month sales on the first of current month and month to date sales of the current month otherwise. Help please ..

• ###### 1. Re: How to get previous month sales on the first of current month and month to date sales otherwise - 10.5

Swapna,

I think we'd need three calculations to solve this: Prior Month Sales, Month To Date Sales, a calculation to swap the two.

Prior Month Sales

THEN [Sales]

END

Month To Date Sales

IF MONTH({MAX([Date])} )= MONTH([Date]) AND YEAR({MAX([Date])} )= YEAR([Date])

THEN [Sales]

END

Swap

IF DAY(Date) = 1 THEN [Prior Month Sales]

ELSE [Month to Date Sales]

END

This is just a guess as your use case could be different depending on your data or the type of graph/chart you're attempting, but this should get you started.

-Wesley

If this post assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 2. Re: How to get previous month sales on the first of current month and month to date sales otherwise - 10.5

Hi Wesley – Thanks so much! This helped me to get started.