Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi there,
I am trying to get the recent date value for the table below.
I have tried the max and lastdate function but I cant seem to get the results i am expecting.
I was able to get a seperate latest effective date column with Measure = Calculate(MAX(Table(Effective_Date), Allexcept(Table, table(id))
Table:
ID | Emp_ID | Interval | Effective_Date | Score |
1 | 1001 | 0 | 01/01/2020 | 3.1 |
2 | 1001 | 0 | 08/26/2020 | 3.3 |
3 | 1001 | 3 | 11/20/2020 | 3.5 |
4 | 1001 | 5 | 05/05/2020 | 3.2 |
5 | 1001 | 5 | 2/1/2021 | 4.1 |
6 | 1002 | 0 | 1/1/2022 | 2.0 |
Expected result if i want to see the recent date values if i filter by interval 0.
ID | Emp_ID | Effective_Date | Score |
2 | 1001 | 8/26/2020 | 3.3 |
6 | 1002 | 1/1/2022 | 2.0 |
or if i dont filter any of the intervals i should get all client IDs with a recent date value witht their corresponding intervals.
ID | Emp_ID | Interval | Effective_Date | Score |
2 | 1001 | 0 | 8/26/2020 | 3.3 |
6 | 1002 | 0 | 1/1/2022 | 2.0 |
3 | 1001 | 3 | 11/20/2020 | 3.5 |
5 | 1001 | 5 | 2/1/2021 | 4.1 |
Solved! Go to Solution.
Hi @yve214 ,
According to your description, refer to the following formula.
Score Measure =
VAR data_recent =
CALCULATE (
MAX ( 'Table'[Effective_Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[Emp_ID] = MAX ( 'Table'[Emp_ID] )
&& 'Table'[Interval] = 0
)
)
RETURN
CALCULATE (
MAX ( 'Table'[Score] ),
ALL ( 'Table' ),
'Table'[Emp_ID] = MAX ( 'Table'[Emp_ID] )
&& 'Table'[Effective_Date] = data_recent
)
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your feedback.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @yve214 ,
According to your description, refer to the following formula.
Score Measure =
VAR data_recent =
CALCULATE (
MAX ( 'Table'[Effective_Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[Emp_ID] = MAX ( 'Table'[Emp_ID] )
&& 'Table'[Interval] = 0
)
)
RETURN
CALCULATE (
MAX ( 'Table'[Score] ),
ALL ( 'Table' ),
'Table'[Emp_ID] = MAX ( 'Table'[Emp_ID] )
&& 'Table'[Effective_Date] = data_recent
)
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your feedback.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@yve214 , use this measure for score ,
Score Measure =
VAR __id = MAX ('Table'[Emp_ID] )
VAR __date = CALCULATE ( MAX('Table'[Effective_Date] ), ALLSELECTED ('Table' ), 'Table'[Emp_ID] = __id )
CALCULATE ( MAX ('Table'[Score] ), VALUES ('Table'[Emp_ID] ),'Table'[Emp_ID] = __id,'Table'[Effective_Date] = __date )
if needed use max for Effective_Date
of try a measure like
calculate(lastnonblankvalues( 'Table'[Effective_Date], MAX ('Table'[Score] ) ))
or
calculate(lastnonblankvalues( 'Table'[Effective_Date], MAX ('Table'[Score] ) ), filter ( allselected(Table) , Table[Emp_ID] = max(Table[Emp_ID]) && Table[Interval] = max(Table[Interval]) ) )
User | Count |
---|---|
12 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
11 | |
7 |