cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FAA
Helper I
Helper I

Calculating differences (previous month)

Hi,

I have to calculate the change in KPI vs Last month. When I use perviousmonth or DATEADD DAX I get correct result when I have months in the table. However, when I remove the months and want to see the change for the current month only (that is for Jan'21 vs Dec'20), I see the difference between 2020 total and Jan'21 result.

How do I fix that?

I just want to see the results for Jan'21 and see the change vs Dec'20 not vs the whole of 2020. 

 

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Don't @FAA,

You can create measures like this:

Previous month =
CALCULATE (
    SUM ( 'Table'[Value] ),
    DATESBETWEEN ( 'Table'[Date], EDATE ( TODAY (), -1 ), TODAY () )
)

Attached to a sample file in the following, you hope it could help.

Best regards
Community Support Team _ Yingjie Li
If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

2 REPLIES 2
v-yingjl
Community Support
Community Support

Don't @FAA,

You can create measures like this:

Previous month =
CALCULATE (
    SUM ( 'Table'[Value] ),
    DATESBETWEEN ( 'Table'[Date], EDATE ( TODAY (), -1 ), TODAY () )
)

Attached to a sample file in the following, you hope it could help.

Best regards
Community Support Team _ Yingjie Li
If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

amitchandak
Super User
Super User

@FAA , there can be few reason time intelligence can fails

 

The date table is not marked as the date table. Date in fact has a timestamp

refer this video : https://youtu.be/OBf0rjpp5Hw

 

and then try measure 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)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin

Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!