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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
mariahMC
Helper I
Helper I

Previous month of last month in dataset

I am trying to create a KPI visual that shows the sum of the last month in the dataset compared to the sum of the previous month (of the last month in the data set). To do this, I created a measure to calculate the previous month total:

 

PreviousMonth = CALCULATE(SUM('CompPayments'[Payment Amount]), PREVIOUSMONTH('CompPayments'[Payment Received Date].[Date]))

 

However, the KPI card shows blank because it's calculating based on current month but I will never have data for the current month.

mariahMC_0-1729634999047.png

 

For example, we are in October but the last month in my dataset is September so I need it to show total of September with the target "goal" being the sum of August. When November hits and I update the dataset, I need it to show October vs September, etc.

 

 

 

1 ACCEPTED SOLUTION

Hi,

I suggest to create a date table.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Hi,

Without seeing your semantic model, I can't be entirely certain, but it seems likely that the latest month is being defined in your model using the TODAY() function in a measure.

If that’s the case, I recommend using the last date from the fact table instead of TODAY() to define the latest month. This way, the latest month will always display the data (no blank), allowing you to compare it with the previous month.

Hope this helps!


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks! I created a date table and filtered by maxdate and that seems to work for now. 

 

PrevMTD =
var maxdate = EOMONTH(TODAY(),-2)
RETURN
CALCULATE(
    SUM('CompPayments'[Payment Amount]),
    FILTER(ALL('Calendar'),'Calendar'[Date] <= maxdate),
    DATEADD('Calendar'[Date],-1,MONTH))
 
mariahMC_0-1730124769162.png

 

 

Right now I am only using one data source in my model as practice since I am new to power bi. Eventually I will add additional sources to my model. Do I need to create a date table?

Hi,

I suggest to create a date table.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi @mariahMC ,

Please update the formula of measure [PreviousMonth] as below and check if it can return the expected result...

PreviousMonth =
CALCULATE (
    SUM ( 'CompPayments'[Payment Amount] ),
    PREVIOUSMONTH ( 'CompPayments'[Payment Received Date] )
)

vyiruanmsft_0-1729650489343.png

Best Regards

I made this change and it gives me September total, but the Goal is blank and not calculating the total of August 

mariahMC_1-1729699011204.png

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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