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

ytd and empty date

Hello,

 

I have a list of accounts with opening and closing dates. Now I need a report that shows the number of open accounts over the month (Year to date, Month to date). The accounts are counted up to the month in which they are closed. I've tried with a calendar table and witgout a relationship to the accounttable, this doesn't work.

accounts_YTD.gif

1 ACCEPTED SOLUTION

@hmo , refer to my HR blog for same. Seem like similar problem

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

Check - https://youtu.be/e6Y-l_JtCq4

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

4 REPLIES 4
amitchandak
Super User
Super User

@hmo , Join both of them with date table one will active another will be inactive assume the closed_on is inactive

 

Try measures like with date tbale and time intelligence

YTD Open = CALCULATE(Count(Table[Account]),DATESYTD('Date'[Date],"12/31")) // date creation is active join

YTD closed = CALCULATE(CALCULATE(Count(Table[Account]), userelationship('Date'[Date], Table[Closed_on]), not(isblank(Table[Closed_on]))),DATESYTD('Date'[Date],"12/31"))

 

Refer why Time intellignce fails : https://youtu.be/OBf0rjpp5Hw

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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

@amitchandak I think this is not the solution table below should end in chart below. We need to count all open accounts by month in the given time period.

 

Account;date_of_creation;closed_on
1;2019-12-10;2019-12-11
2;2019-12-10;2020-01-02
3;2019-12-10;
4;2019-12-10;2020-02-25
5;2019-12-10;2020-05-13
6;2020-01-03;2020-03-14
7;2020-03-11;2020-05-11

 

bars.gif

@hmo , refer to my HR blog for same. Seem like similar problem

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

Check - https://youtu.be/e6Y-l_JtCq4

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

@amitchandak Thank you very much. I think this formula in your post leads me to the right results:

Current Employees = 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))

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.

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.