Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
DeEviloN
Helper III
Helper III

PREVIOUSMONTH(DATESMTD

I have a measure that calculates based on the amount for the month of the last sales with the previous month when there were sales

 

Prev last MTD Sales = CALCULATE (SUM ('Добавить1'[Количество изделий всего, шт]), PREVIOUSMONTH(DATESMTD ('Добавить1'[Дата выдачи])))

 

DeEviloN_0-1637918485258.png

But he does not always see the previous month of sales, how to fix it?

1 ACCEPTED SOLUTION

@DeEviloN ,  Try like

 

Last Month non Continuous = CALCULATE([sales],filter(ALL('Date'),eomonth('Date'[Date]) =eomonth( CALCUALTE( MAx(Table[Date]), FILTER(ALL('Date'),'Date'[Date]<max('Date'[Date]))),0)))

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@DeEviloN , You have to try like

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

previous month value = CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

This method does not work as the specified client made the payment in October, and before that in August

@DeEviloN ,  Try like

 

Last Month non Continuous = CALCULATE([sales],filter(ALL('Date'),eomonth('Date'[Date]) =eomonth( CALCUALTE( MAx(Table[Date]), FILTER(ALL('Date'),'Date'[Date]<max('Date'[Date]))),0)))

In your case, when you write a formula without specifying the month and close the parentheses, you get an error



help please, in the case when I put 1, then he counts the previous month, when 0 does not see it, but when choosing another client at 0 he sees the previous month, and at 1 not, how to fix it?

 

Prev last MTD Sales = CALCULATE (SUM ('Добавить1'[Количество изделий всего, шт]), FILTER(ALL('Добавить1'[Дата выдачи]),EOMONTH('Добавить1'[Дата выдачи],0)=EOMONTH(CALCULATE(MAX('Добавить1'[Дата выдачи]),FILTER(ALL('Добавить1'[Дата выдачи]),'Добавить1'[Дата выдачи]<max('Добавить1'[Дата выдачи]))),0)))

 

Безымянный3.pngБезымянный2.pngБезымянный.png

What does ('Table'[total hours value]?

@DeEviloN , Just a different measure in example ,

 

like

 

MTD = CALCULATE(SUM ('Добавить1'[Количество изделий всего, шт]),DATESMTD('Date'[Date]))
last MTD = CALCULATE(SUM ('Добавить1'[Количество изделий всего, шт]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

previous month = CALCULATE(SUM ('Добавить1'[Количество изделий всего, шт]),previousmonth('Date'[Date]))

 example file  look at this please

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.