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
pmc0861
Regular Visitor

DAX measure for calculating open values between two dates - Power Pivot

Hi,

 

New to Power Pivot and DAX so please excuse if this isn't the correct place to post or my question is utterly ridiculous.

 

I have a table that has a list of purchase orders. The table includes two date columns, one for the date the PO was opened and the other for the date the PO was closed.

pmc0861_0-1671502870632.png

 

I also have a dimension table that lists months

 

pmc0861_1-1671502918143.png

 

What I'm wanting to do is create a pivot table using power pivot that shows the open value of purchase orders at a point in time determined by the mth and lists the open values as follows (open value is sum of Amount where open_date <= Month & close_date > Month):

 

pmc0861_2-1671503044727.png

I'm unsure how to define this in a measure in Power Pivot as I'm not sure how to link it to the month table. I've tried a few things and even just trying something simple like only using one date I can't work out... 

 

pmc0861_4-1671503295774.png

 

Ideally I'd like a measure that looks at both dates or if recommend a better way to be looking at this.

 

Any help would be appreciated as again, I'm very new to this.

 

thanks!

1 ACCEPTED SOLUTION

OK.... scratch the above. I had a relationship set with the date table that I've now marked as inactive and its giving me what I expected.

View solution in original post

3 REPLIES 3
pmc0861
Regular Visitor

Thanks. This definitely got me moving in the right direction (stepping through this one part at a time).... I've got my DAX expression now as:

 

CALCULATE(SUMX(FILTER(PO_Committed,PO_Committed[AddedMth]<=max(Month_Tbl[Month])),[OrigCost])

)

 

Note that column names are a little different from my original post as original post was simplified to clarify the issue I was having.

 

For some reason, the above DAX only gives me items added in that month rather than in that month or earlier despite using <= in the filter. Any idea why this would be happening?

OK.... scratch the above. I had a relationship set with the date table that I've now marked as inactive and its giving me what I expected.

amitchandak
Super User
Super User

@pmc0861 , seems similar to the HR use case - https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.