# Previous Month Totals from MAX Date

Hello all,

I am having a hard time finding a “Previous Month” totals from a Max Date measure that I already have “Max Date”.
I have a Date table “Date” a “Fact_Dim” table and a “Fact” table in the data model.

Fact_Dim:
Total Exception Amount of Previous Month =
CALCULATE( SUM( Fact[Amount Exception] ),
FILTER( ALLSELECTED( ‘Date’ ),
‘Date’[Date] = [Previous Date]))

Date:
Previous Date =
EOMONTH([Max Date], -1)

Date:
Max Date =
CALCULATE(MAX(Fact[Certification Date]),
FILTER(ALLSELECTED(‘Date’[Date]),
‘Date’[Date] = LASTDATE(Fact[Certification Date] )))

I am trying to get the “Total Exception Amount of Previous Month” to work, but it gives me blanks when putting it in a cross table visual. It works in a card visual as it looks like it’s calculating for the total. Is there a different way to get the previous month total based on a “Max Date” measure?
I use the “Max Date” measure to calculate the last day as I will always have 1 1/2 months lag from current date and I want it to be dynamic.
I have also tried using the below measure "Total Exc Lates Month -1" and incorporate it in my “Total Exception Amount of Previous Month”, but I get a the message “An Argument of Function Date has wrong data type or the result is too small or too large” error, which I am guessing it’s b/c it does not know which date to use.
Fact:
Total Exc Latest Month -1 =
VAR vLastDate = MAX(Fact[Certification Date])
VAR PreMonth = DATE(Year(vLastDate), MONTH(vLastDate) -1, DAY(vLastDate))
RETURN

Thanks,
Saul

Hi @ITSaulgood, I noticed you didn’t provide a PBIX file. Providing one will help users and experts find a solution to your inquiry faster and better.

A perfect initial question includes all of the following:

• A clear explanation of the problem you are experiencing

• A mockup of the results you want to achieve

• Your current work-in-progress PBIX file

• Your underlying data file (to allow us to go into Power Query if necessary to transform your data and/or data model – often DAX questions really end up being data modeling solutions)

Check out this thread on Tools and Techniques for Providing PBIX Files with Your Forum Questions

Not completing your data may sometimes cause delay in getting an answer.

Hi @ITSaulgood, we’ve noticed that no response has been received from you since July 6th.

We are waiting for the masked demo pbix file and any other supporting links and details.

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

Hello,
Apologies that I have not been able to upload the .pbix file. It will take me a few days to prepare. I will mark this entry as “Solved” and I will create a new one once I have the .pbix file ready at a later time.
Thank you.