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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SuzieKidd
Frequent Visitor

Count people that appear in every financial year

Hi, I have a table of people with start and end dates, the start date is linked to my caldender table date and I need to be able to count the people for each financial year that the episode was open for.  I have added a column into my caldendar table to show the financial year and I'm using this as my filter, however it seems to only be counting those that started in a financial year and not counting them in subsequent years where it was still open.  I'm very new to Power BI and any help with this would be greatly appreciated.  Thank youFinancial Years.PNG

1 ACCEPTED SOLUTION

 

No problem.

If you want the count of ANY people that featured during the year, not just thse still present at the end of the year, use this measure instead:

_noofEmployeesFeatured_ot =
VAR __maxDate = MAX(calendar[date])
VAR __minDate = MIN(calendar[date])
RETURN
CALCULATE(
    DISTINCTCOUNT(yourTable[ID]),
    FILTER(
        yourTable,
        yourTable[Start Date] <= __maxDate
        && (__minDate < yourTable[End Date] || ISBLANK(yourTable[End Date]))
    )
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
BA_Pete
Super User
Super User

Hi @SuzieKidd ,

 

Try an 'over time' measure like this:

 

_noofEmployees_ot =
VAR __cDate = MAX(calendar[date])
RETURN
CALCULATE(
    DISTINCTCOUNT(yourTable[ID]),
    FILTER(
        yourTable,
        yourTable[Start Date] <= __cDate
        && (__cDate < yourTable[End Date] || ISBLANK(yourTable[End Date]))
    )
)

 

Remove or disable the relationship you have between calendar[date] and yourTable[Start Date], then put this measure into a visual with calendar[FY] and it will give you the count of people present at the end of each year.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Thank you so much for this, although not giving me a count of all the people who appeared in the FY, including those that closed within the FY, this is very close to what I'm after.  Once again, thank you so much 🙂

 

No problem.

If you want the count of ANY people that featured during the year, not just thse still present at the end of the year, use this measure instead:

_noofEmployeesFeatured_ot =
VAR __maxDate = MAX(calendar[date])
VAR __minDate = MIN(calendar[date])
RETURN
CALCULATE(
    DISTINCTCOUNT(yourTable[ID]),
    FILTER(
        yourTable,
        yourTable[Start Date] <= __maxDate
        && (__minDate < yourTable[End Date] || ISBLANK(yourTable[End Date]))
    )
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Pete, thank you so much, that works like a dream.  Have a great afternoon Suzie

Helpful resources

Announcements
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!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors