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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
binoobie
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?

3 REPLIES 3
binoobie
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.

Anonymous
Not applicable

@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

lbendlin
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

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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