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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
orange_
Regular Visitor

Get previous month's total value in DAX

Hi Everyone,

I have a table like below:

orange__0-1737015077015.png

and I want to calculate MoM but my DAX for previous month's value does not work. 
This is my DAX:

orange__0-1737015515665.png

orange__1-1737015178519.png

and here's my table result:

orange__2-1737015225700.png

What's wrong with my formula? hmm
Thanks all,

4 REPLIES 4
v-xinc-msft
Community Support
Community Support

Hi @orange_ ,
This my data table.

1.png

Is it necessary to achieve the following effects? 

2.png

And this is my Dax.

TotalBuyAmount = 
CALCULATE(
    SUM('Table'[Amount]),
    'Table'[Type] = "BUY",
    ALLEXCEPT('Table', 'Table'[Month], 'Table'[Year])
)
PreviousMonthCumulative = 
CALCULATE(
    [TotalBuyAmount],
    FILTER(
        ALL('Table'),
        'Table'[Type] = "BUY" &&
        'Table'[Date] <= MAX('Table'[Date])
    )
)

You could get more detailed information by checking the attachment.

If you have any other concerns, please feel free to share with us here so that we can offer more support.!

Best regards,

Lucy Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

what should I do now?

Hi @orange_ ,

Thank you for your kind reply!

Could you please provide example data or sample files here if you have any confused? We could offer you more help if we have information in detail. There is sensitive data that can be removed in advance. How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.

Best regards,

Lucy Chen

Hi Lucy Chen,

I am very happy that you have helped me, but there are a few small mistakes here, I want to get previous month value, I'm sorry for the lack of clarity.
I added Calendar table with Date column like below

orange__0-1737085817258.png

and then joined Calendar table with column eom_date of Calendar table, but my DAX still not working

orange__1-1737086063601.pngorange__2-1737086118061.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors