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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
tahir9
Frequent Visitor

Getting prior month data to display for current month?

Hello i am trying to display the prior month totals as a measure in a table where i am showing the totals by month and year... but my measure formula isn't working not sure why? Here is the formula:

 

Prior days = CALCULATE(SUM('Calendar'[Work Day]),PARALLELPERIOD('Calendar'[Date].[Date],-1,MONTH))

 

As you can see in the table below i want the 24 for january to show up in february and so on... but the formula above only returns that months totals... 

 

image.png

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @tahir9

 

Please try this calculated measure

 

Prior days = 
    CALCULATE(
        SUM('Calendar'[Work Day]),
        ALL('Calendar'),
        PREVIOUSMONTH('Calendar'[Date])
        )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

4 REPLIES 4
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @tahir9

 

Please try this calculated measure

 

Prior days = 
    CALCULATE(
        SUM('Calendar'[Work Day]),
        ALL('Calendar'),
        PREVIOUSMONTH('Calendar'[Date])
        )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

that worked Phil! Thank you! Just curious if you could explain why that worked but my method did not... ?

HI @tahir9

 

The magic function in my calculation is the ALL function.  This allows me to remove the implicit filtering being applied to the underlying dataset and have access to different rows.  If you do some internet searching for DAX Filter Context, there will be a bunch of articles or blogs that describe it.  I have a section in my book (aka.ms/practicalDAX) that you may also find useful.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks Phil will check out your book as well as these other resources! 

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!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.