dynamic date
2 TopicsLookupvalue 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?438Views0likes1CommentDate Reference as parameter to determine True/False
Hello, I am trying to determine wether a license is active or expired based on License Start Date, License End Date and a Reference Date (can be today or any other date). Here is the logic for an Active License: VAR LicenseActiveLogic = FIRSTDATE ( LineItem[Start Date] ) < LASTDATE ( ReferenceDAte[Date] ) && LASTDATE ( LineItem[End Date] ) > LASTDATE ( ReferenceDAte[Date] ) I have four tables: Product (product name), Opportunity (opportunity name), LineItem (start date, end date, product name) and RefereceDate (the reference date). I am trying to make a measure (since column cannot dynamically calculate with a new reference date) that shows me, for each product in my visual, something like this: _Active License = VAR LicenseActiveLogic = FIRSTDATE ( LineItem[Start Date] ) < LASTDATE ( ReferenceDAte[Date] ) && LASTDATE ( LineItem[End Date] ) > LASTDATE ( ReferenceDAte[Date] ) RETURN IF ( LicenseActiveLogic, TRUE (), FALSE () ) the above returns a weird cartesian product. I tried the below, but the Active License count is wrong.. I don't know what is happening: _Active License 2 = VAR LicenseActiveLogic = FIRSTDATE ( LineItem[Start Date] ) < LASTDATE ( ReferenceDAte[Date] ) && LASTDATE ( LineItem[End Date] ) > LASTDATE ( ReferenceDAte[Date] ) RETURN CALCULATE ( DISTINCTCOUNT ( Product[Prod Name] ), KEEPFILTERS ( FILTER ( CROSSJOIN ( ReferenceDAte, LineItem, 'Product', Opportunity ), LicenseActiveLogic ) ) ) this one shows me only the active licenses and counts wrong. Ideally, I want to see something like this in my visual: Reference Date: 1 September 2022 Oppty Name Prod Name Start Date End Date License Active Opportunity 5 Product 5 9/15/2022 0:00 9/15/2023 0:00 FALSE Opportunity 4 Product 2 4/5/2021 0:00 1/5/2023 0:00 TRUE Opportunity 4 Product 3 11/12/2021 0:00 1/5/2023 0:00 TRUE Opportunity 4 Product 3 1/5/2022 0:00 1/5/2023 0:00 TRUE Opportunity 4 Product 5 1/5/2022 0:00 1/5/2023 0:00 TRUE Opportunity 3 Product 5 12/12/2020 0:00 1/1/2022 0:00 FALSE Opportunity 3 Product 5 1/1/2021 0:00 1/1/2022 0:00 FALSE Opportunity 2 Product 2 2/2/2020 0:00 6/7/2021 0:00 FALSE Opportunity 2 Product 2 6/7/2020 0:00 6/7/2021 0:00 FALSE Opportunity 2 Product 3 3/4/2020 0:00 6/7/2021 0:00 FALSE Opportunity 1 Product 1 1/1/2019 0:00 1/1/2020 0:00 FALSE If I change the reference date to any other, it will correctly display TRUE/FALSE based on my license condition. Can this be done? I am attaching the PBIX file here PLEASE HELPSolved1.4KViews0likes6Comments