Forum Discussion
Can't get the recent Date Values
- 4 years ago
Hello yve214.
I was able to get this to work by creating a new table with the following DAX:
New table = ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Emp_ID], 'Table'[Interval] ), "Effective Date", CALCULATE( MAX( 'Table'[Effective_Date] ) ), "Score", CALCULATE( MAX( 'Table'[Score] )), "ID", CALCULATE( MAX( 'Table'[ID] ) ) )I created a .pbix file that you can download here.
-Steve - 4 years ago
Hi yve214. Ah, I think understand now. See if this works for you:
Count of Emp IDs = CALCULATE ( DISTINCTCOUNT ( 'Table'[Emp_ID] ), FILTER ( 'Table', VAR CurrentRowEmpID = 'Table'[Emp_ID] RETURN VAR IntervalZeroEffectiveDate = CALCULATE ( MIN ( 'Table'[Effective_Date] ), ALL ( 'Table' ), 'Table'[Interval] = 0 && 'Table'[Emp_ID] = CurrentRowEmpID ) RETURN 'Table'[Interval] = 6 && 'Table'[Effective_Date] > IntervalZeroEffectiveDate ) )
Sorry the date filter works for the interval 6 > interval 0.
I was able to add a row 13 for emp ID 2001 to test how it works and I noticed
- its counting the correct filtered rows but not the distinct emp ID counts
When i placed the results in a tableview it gave me a context view butI see 2001 twice since it counted the rows rather than the distinct call out. I tried tweaking yours too but I get the same total as if the dates didnt filter.
sorry not sure why i cant attach file
Hi yve214. Ah, I think understand now. See if this works for you:
Count of Emp IDs =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Emp_ID] ),
FILTER (
'Table',
VAR CurrentRowEmpID = 'Table'[Emp_ID]
RETURN
VAR IntervalZeroEffectiveDate =
CALCULATE (
MIN ( 'Table'[Effective_Date] ),
ALL ( 'Table' ),
'Table'[Interval] = 0
&& 'Table'[Emp_ID] = CurrentRowEmpID
)
RETURN
'Table'[Interval] = 6
&& 'Table'[Effective_Date] > IntervalZeroEffectiveDate
)
)- yve2144 years ago
Helper III
SteveHailey thank you so much for your help. Everything worked out perfectly.