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
Anonymous
Not applicable

Get Value for Previous Month

Hi there,

 

Im trying to calculate a MOM%, but I can't get the measure to calculate the Current Month or the Previous Month Value.

 

I've tried:

=Calculate(sum(sales),PreviousMonth(Date))

 

=Calculate(sum(sales),DateAdd(date,-1,Month))

 

=Var MaxMonth = Max(Date[Month])

Var MaxYear = Max(Date[Year])
Return
Calculate(sum(sales),Month(date)=MaxMonth-1,Year(date)=MaxYear))

 

 

I built this measure on top of an already working one with the formula =Calculate(sum(sales),PreviousMonth(Date))

but when I try it with these values, the result I get is the Total of all period.

*Edit* - I had to remove the printscreen due to NDA. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

That didn't work.

 

However, what worked was, adding to each of my variables a filter for the previous month and same year and then sum them all

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Previous month give complete last month data,

So the options you have

 

Calculate(sum(Sales[sales]),DateAdd(date,-1,Month))

 

or

 

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

 

And you have use date and related field only from date table.

 

Date table should be marked as date table

 

refer if needed

Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

Anonymous
Not applicable

That didn't work.

 

However, what worked was, adding to each of my variables a filter for the previous month and same year and then sum them all

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.