cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jengwt Member
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
jengwt Member
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 v-yuezhe-msft
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.
jengwt Member
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.

jengwt Member
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.