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

Inactive relation causing the filter to not work

Hi Guys,

Need help with dealing with an inactive relationship below in HR data.

Yolo_pbi_0-1709180845536.png

Context: I am trying to get the total active employees based on the date slicer from date table and the condition am using is max(date) >= joining date, and < last day at work or last day at work = blank. 

Output is returning for only last day at work = blank. Can someone please help -.-




as it's not making my DAX work: 

Headcount =
CALCULATE(
    DISTINCTCOUNT(DET[Staff Member]),
    FILTER(
        DET,
        DET[Joined] <= MAX('Date'[Date]) &&
        (
            DET[Last Date Worked] > MAX('Date'[Date]) || ISBLANK(DET[Last Date Worked])
        )
    )
)
2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Yolo_pbi ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
some_bih
Super User
Super User

Hi @Yolo_pbi not enought infos to provide some sound solution. 

Still, try v2

Headcount v2 =

VAR __max_date=MAX('Date'[Date])
RETURN
CALCULATE(
DISTINCTCOUNT(DET[Staff Member]),
FILTER(
DET,
DET[Joined] <= __max_date &&
(
DET[Last Date Worked] > __max_date || ISBLANK(DET[Last Date Worked])
)
)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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