cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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?

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.

View solution in original post

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.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

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

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

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.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

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

Users Online
Currently online: 51 members 1,451 guests
Please welcome our newest community members: