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

Lookupvalue where measure = 1

Hi Everyone,

 

Hitting my head against a wall on this DAX for a while now, and figured it was well past time to see if anyone has insights on what I'm trying to do. My goal is to create a raw data dive that reflects data as of a certain date for teams to sort through. The issue I'm having so far is that when I try to do that, if there is a change in value to the employee's data, it will duplicate lines of data where the only difference will be to reflect that change, rather than show the appropriate one.

 

Data Structure

The data table I'm working on is effective dated. The columns I care about are:


'Employee ID', 'Employee Key', 'Effective Date', 'End Effective Date'

 

Employee ID is the ID number associated with Each Employee. Each Employee ID will have multiple records attached to it, each of which will have a beginning date and ending date (Effective Date and End Effective Date respectively)

 

Employee Key is an index column where each row gets a distinct number to help identify it in the full table. 

 

Headcount Measure

 

Dax is Below, but the goal of this measure is to show which records per employee ID are active within a time period (there are additional filters involving employee status that aren't relevent here but are built into the Headcount Measure Dax).  This Dax works and I don't have issues with it but it's relevant to the question below. 

 

HEADCOUNT_EOP =

 

VAR _date = MAX('Date'[Date])

 

RETURN CALCULATE(

    DISTINCTCOUNT('Timekeeper History'[Employee_ID]),

    _date >= 'Timekeeper History'[Map.PSJob.EffectiveDate] && _date < ('Timekeeper History'[Map.PSJob.EndEffectiveDate]),

    'Timekeeper History'[RecordEndDate] >= 'Timekeeper History'[Map.PSJob.LastHireDate]

)

 

Here's what I'm Trying To Do

My headcount measure above flags records that are "live" when I move around in my timeline. So when I change a date filter, or map out a bar graph to reflect timeline, it will count the appropriate records accordingly.

 

Is there a way to create a dynamic employee key that basically goes:

 

IF HEADCOUNT_EOP = 1, [HERE IS THE EMPLOYEE KEY THAT IS ASSOCIATED WITH THAT LINE OF DATA],  "" ?

 

My goal here is then to be able to filter out rows of data where the dynamic employee key =/= that line of data's employee key. Everything I have tried has gotten mad at me with how many variable maximum values I've been playing with.

 

Is this doable? Does this make sense?

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.