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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Hickling
Frequent Visitor

Count open items each day, 2 date columns

Hi team,

 

I have a date table, and a data table, the three relevant columns from the data table are:

 

IDDate IssuedCompliance Date
11/01/202010/01/2020
25/01/202014/01/2020
313/01/202020/01/2020
416/01/202022/01/2020

 

I need 3 measures, 2 I've done, stuck on the third. My date table has an active relationship between Date and Date Issued, and an inactive relationship between Date and Compliance Date.

 

For the first measure, items raised on a given day, it's just a distinctcount of the id

 

For the second measure, items closed on a given day, it's

CALCULATE([Raised], USERELATIONSHIP('Calendar'[Date],'Data Table'[Compliance Date]))
 
The third measure, I need to be able to show how many were open on any given day. So where Date Issued is <= 'Calendar'[Date], and Compliance Date is > 'Calendar'[Date] || Blank. 
 
Edit: Sorry I should add that I'm trying to avoid doing this in another table like I usually would, because the visual output for this measure will require using a slicer and/or legend for other columns in the data table
1 ACCEPTED SOLUTION
swikritee_p
Resolver II
Resolver II

@Hickling , You can try a measure like one used in HR Analytics 

CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date]))),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))

You can refer this blog

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

View solution in original post

2 REPLIES 2
swikritee_p
Resolver II
Resolver II

@Hickling , You can try a measure like one used in HR Analytics 

CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date]))),(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))

You can refer this blog

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

This is perfect, thank you!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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