Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yve214
Helper III
Helper III

Help with Recent date value

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:

IDEmp_IDIntervalEffective_DateScore
11001001/01/20203.1

2

1001008/26/20203.3
31001311/20/20203.5
41001505/05/20203.2
5100152/1/20214.1
6100201/1/20222.0

 

Expected result if i want to see the recent date values if i filter by interval 0.

 

IDEmp_IDEffective_DateScore
210018/26/2020

3.3

610021/1/20222.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.

 

IDEmp_IDIntervalEffective_DateScore
2100108/26/2020

3.3

6100201/1/20222.0
31001311/20/20203.5
5100152/1/20214.1

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

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
    )

vhenrykmstf_0-1643877776860.png


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.

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

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
    )

vhenrykmstf_0-1643877776860.png


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.

amitchandak
Super User
Super User

@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]) ) )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors