cancel
Showing results for
Did you mean:
Member

## Re: Last Month calculations do not work in January

@v-yuezhe-msft It will be difficult to resolve this after January and the functions resume working "correctly" again.

Want to try having a call?

Highlighted
Member

## Re: Last Month calculations do not work in January

Ok I figured it out. It's actually pretty simple; you just explicitely tell PBI what to do in January:

```Population_LM =
VAR LMDs = [LM_Days]
VAR DN = [DNOW]VAR MDN = MONTH(DN)VAR YDN = YEAR(DN)
RETURN ROUND(
DIVIDE(
CALCULATE(
SUM('Population'[COUNT])
, CALCULATETABLE('Population'
, MONTH('BI-DATE_DIM'[DIM_DATE]) =
IF(MDN = 1
, 12
, MDN
)
&& YEAR('BI-DATE_DIM'[DIM_DATE]) =
IF(MONTH(DN) = 1
, YDN - 1
, YDN
)
)
)
, LMDs
)
, 0
)```

and,

```Loss_LM = -- STATIC CALC
VAR DN = [DNOW]VAR MDN = MONTH(DN)VAR YDN = YEAR(DN)
RETURN CALCULATE(
COUNT('Losses'[ID])
, CALCULATETABLE(Losses'
, MONTH('BI-DATE_DIM'[DIM_DATE]) =
IF(MDN = 1
, 12
, MDN
)
&& YEAR('BI-DATE_DIM'[DIM_DATE]) =
IF(MDN = 1
, YDN - 1
, YDN
)
)
)```

I still think those PREVIOUS...() functions don't really work as envisioned.

Moderator

## Re: Last Month calculations do not work in January - Status changed to: Delivered

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

## Re: Last Month calculations do not work in January - Status changed to: Delivered

@v-yuezhe-msft I would have, but it wouldn't let me mark my own reply as a solution. Thank you for doing so.

Member

## Re: Last Month calculations do not work in January - Status changed to: Delivered

@v-yuezhe-msft I would like to state that just because I found a workaround doesn't mean the root problem is resolved. I disagree with the status being "delivered", and suggest that Microsoft still take this up as a bug.

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 219 members 2,530 guests
Recent signins: