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
wrv505
Frequent Visitor

Help with a measure on a simple model

I have a simple data model of a "tblCases" table and an accompanying "tblCalendar" table with the following relationships:

 

Active Relationship: tblCalendar[Date] ---> tblCases[CreatedOn]

Inactive Relationship: tblCalendar[Date] ---> tblCases[Resolution Date]

 

tblCalendar has a column that returns the Monday date of any given date called [Week Starting Date (Monday)] and is what the data is to be grouped by (so we can see results for each week).

 

I have created a matrix visual grouped by [Week Starting Date (Monday)] as the rows and have added the following measures as values:

 

Total Created = CALCULATE(COUNTA(tblCases[CaseId]))

Total Resolved = CALCULATE(COUNTA(tblCases[CaseId]),USERELATIONSHIP(tblCalendar[Date],tblCases[Resolution Date]))

 

These work fine. However, I need another measure that shows me how many cases are still open at the end of the week. This isn’t as simple as just doing a calculation on the above 2 measures because there will be cases already open going into any given week that need to be taken into consideration too. The measure therefore instead needs to be a COUNTA of the [CaseId] field but to also include the following logic / filters:

 

tblCases[CreatedOn] < tblCalendar[Week Starting Date (Monday)] +7 (on the relevant week in matrix visual)

AND

(tblCases[Resolution Date] >= tblCalendar[Week Starting Date (Monday)] +7 (on the relevant week in matrix visual) OR

tblCases[Resolution Date] = BLANK)

 

I’ve tried many variations of formulas but can’t seem to get it right. I also tried creating a separate Date table with columns replicating the totals from the measures, but I need the ability to slice the data by other fields and also see the underlying records in tblCases so this didn’t work.

 

Any ideas are welcome.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@wrv505 , refer if the blog can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@wrv505 , refer if the blog can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

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

Perfect, thank you.

Greg_Deckler
Community Champion
Community Champion

@wrv505 - Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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