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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JayproviBI
Regular Visitor

How to combine calculate and EOMONTH Filter

Hello, i have the following Measure

last month = calculate(sum('Table 1'[Revenue]),
'Table 1', eomonth('Table 1'[ReportDate],-1))
or 
last month = calculate(sum('Table 1'[Revenue]),
'Table 1', 'Table 1'[ReportDate] = eomonth('Table 1'[ReportDate],-1))
 
With this measure i want to generate the revenue of the last day of the previous month. I have tried multiple adjustment but it doesnt seem to work. It works with 'Today()' but i want that viewers/users can change the 'reportdate' (with a filter) and that the PBI table will generate information about the last 3 months (on the last day) so i have multiple measures like this last month, 2nd last month, 3th last month. 
Im looking forward to your solutions!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @JayproviBI 
Please try

last month =
CALCULATE (
    SUM ( 'Table 1'[Revenue] ),
    'Table 1'[ReportDate] = EOMONTH ( MAX ( 'Table 1'[ReportDate] ), -1 )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @JayproviBI 
Please try

last month =
CALCULATE (
    SUM ( 'Table 1'[Revenue] ),
    'Table 1'[ReportDate] = EOMONTH ( MAX ( 'Table 1'[ReportDate] ), -1 )
)

Your the man! Thanks, Highly appreciated. It works! 

NikhilChenna
Continued Contributor
Continued Contributor

Hi @JayproviBI ,

I think the second meaure could work please try to create the EOM meaure and then use it in your measure.

EOM = eomonth('Table 1'[ReportDate],-1)

 

last month = calculate(sum('Table 1'[Revenue]),
'Table 1''Table 1'[ReportDate] = EOM)
 

Regards, 
Nikhil Chenna 


Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

 

Thank you for your reaction. Unfortunately i cant create this measure because i cant use directly eomonth and connect to the table. When i use the filter function like '

EOM.lastmonth = filter('table 1', eomonth('table 1'[ReportDate],-1))'

and use it on my primary measure i get an error message

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors