cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Getting prior month data to display for current month?

Hello i am trying to display the prior month totals as a measure in a table where i am showing the totals by month and year... but my measure formula isn't working not sure why? Here is the formula:

Prior days = CALCULATE(SUM('Calendar'[Work Day]),PARALLELPERIOD('Calendar'[Date].[Date],-1,MONTH))

As you can see in the table below i want the 24 for january to show up in february and so on... but the formula above only returns that months totals...

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft

## Re: Getting prior month data to display for current month?

HI @tahir9

```Prior days =
CALCULATE(
SUM('Calendar'[Work Day]),
ALL('Calendar'),
PREVIOUSMONTH('Calendar'[Date])
)```

Proud to be a Datanaut!

4 REPLIES 4
Microsoft

## Re: Getting prior month data to display for current month?

HI @tahir9

```Prior days =
CALCULATE(
SUM('Calendar'[Work Day]),
ALL('Calendar'),
PREVIOUSMONTH('Calendar'[Date])
)```

Proud to be a Datanaut!

Frequent Visitor

## Re: Getting prior month data to display for current month?

that worked Phil! Thank you! Just curious if you could explain why that worked but my method did not... ?

Microsoft

## Re: Getting prior month data to display for current month?

HI @tahir9

The magic function in my calculation is the ALL function.  This allows me to remove the implicit filtering being applied to the underlying dataset and have access to different rows.  If you do some internet searching for DAX Filter Context, there will be a bunch of articles or blogs that describe it.  I have a section in my book (aka.ms/practicalDAX) that you may also find useful.

Proud to be a Datanaut!

Frequent Visitor

## Re: Getting prior month data to display for current month?

Thanks Phil will check out your book as well as these other resources!

Announcements

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

#### Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!