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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

Measure to calculate previous month values with a strict data context

Hello fellow bi collegues,

I'm struggling to define a dax measure that would return the number of issues (I work with azure devops data) for the previous month only; kinda fixed context in the measure, what I did so far is:




!totClosedLastMonth = CALCULATE([!workItemCount],fact_devops[WorkItemType]="Issue",fact_devops[State]="Closed",DATEADD(dim_date[Date],-1,MONTH),USERELATIONSHIP(dim_date[Date],fact_devops[DATEKEYCLOSED]))




and it works but it requires to enforce context somewhere in filters, I'd like that measure to return a fixed value for the previous month comparing to the current one. How to do that?

New Member

Yes, I want a filter context (report level) to be fixed and restricted for current and previous month (given report display time by a report user) only - without letting user to get back deeper in the past. Not neccesairly want this to change every month and I already did that using variables and defining current and previous months using EOMONTH and TODAY functions.

@lbendlin Thanks for your contribution on this thread.

Hi @binoobie ,

I still don't understand what your needs are? Could you please clarify your requirements? Are you attempting to calculate the difference between the current month’s value and the previous month’s value? If possible, providing sample data with Text format and practical examples would greatly assist in understanding your logic and desired outcome. It would be helpful to find out the solution. You can refer the following link to share the required info:

How to provide sample data in the Power BI Forum

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

 I'd like that measure to return a fixed value for the previous month comparing to the current one.


The interpretation of "current month"  and "previous month"  depends on the filter context. If you hard code that then you have to change your report design every month, Surely you don't want that?

Helpful resources

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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


Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.