cancel
Showing results for
Did you mean:
Highlighted
Regular Visitor

## Create a measure that shows me the previous month

Hello

Any ideas how i create  a measure to show the previous month count.

Thanks
Ross

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Create a measure that shows me the previous month

Hi @rosscortb,

1. Create a date table, and create relationship between it and the fact table.

`date = CALENDARAUTO()`

2. To create the measure to get the amount of the previous month.

`Previous = CALCULATE(SUM(Table1[headcount]),DATEADD('date'[Date],-1,MONTH))`

Please check the pbix as attached.

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
7 REPLIES 7
Super User

## Re: Create a measure that shows me the previous month

Please try this formula. COUNT can be replaced by SUM based on your data nature( if your coulmn already has count then you need to use sum)..

`LastMonth Headcount=CALCULATE(COUNT(Table.column1),DATEADD(Dates[Date],-1,MONTH)`

Thanks

Raj

Regular Visitor

## Re: Create a measure that shows me the previous month

Hi Raj

Thanks for your reply. I used your code but it returns the combined total of April to November?

Any ideas?

Ross

Member

## Re: Create a measure that shows me the previous month

Is that we see your dataset (so one row per month) or you have an underlying date table with day-by-day data?

Regular Visitor

## Re: Create a measure that shows me the previous month

Hello,

I have head count table with a date column, dd/mm/yy and I have a calendar table that I created using the following link

https://kohera.be/blog/power-bi/how-to-create-a-date-table-in-power-bi-in-2-simple-steps/

Thanks

Ross

Community Support Team

## Re: Create a measure that shows me the previous month

Hi @rosscortb,

1. Create a date table, and create relationship between it and the fact table.

`date = CALENDARAUTO()`

2. To create the measure to get the amount of the previous month.

`Previous = CALCULATE(SUM(Table1[headcount]),DATEADD('date'[Date],-1,MONTH))`

Please check the pbix as attached.

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Support Team

## Re: Create a measure that shows me the previous month

Hi @rosscortb,

Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regular Visitor

## Re: Create a measure that shows me the previous month

it doesn't seem to work for me. In your example you have typed in the headcount while my headcount is based on individuals rows so its counting those rows to work out the headcount for each month