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?

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.

Highlighted
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

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

#### PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 103 members 1,505 guests
Recent signins: