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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Kavya123
Helper III
Helper III

Latest date data

Hi Everyone,

 

I need to create a column display the latest values based on the year selection.

For example:

If I select code "BEVH" and year 2015 it should display the value 94.

If I select code "BEVH" and select both the years 2015 and 2016  then it should display the value 95 (latest date data based on  multi year selection)

 

CodeYear(MM/DD/YYYY)FIValue
BEVH4/1/201493
BEVH6/1/201594
BEVH1/1/201598
BEVH1/1/201695
BWH1/1/201486
BWH6/1/201698.2
BWH4/1/201696.3
CATH4/1/201380
CATH6/1/201587

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Kavya123 ,

 

I suggest you to create an unrelated Year table for slicer. Then create a measure to calculate the latest date data based on selection.

Year Selection =
VAR _ADD =
    ADDCOLUMNS (
        VALUES ( 'Table'[Year(MM/DD/YYYY)] ),
        "Year", YEAR ( [Year(MM/DD/YYYY)] )
    )
VAR _SUMMARIZE =
    SUMMARIZE ( _ADD, [Year] )
RETURN
    _SUMMARIZE

Measure:

Latest date data = 
VAR _SELECT_YEAR =
    VALUES ( 'Year Selection'[Year] )
VAR _LAST_DAY =
    CALCULATE (
        MAX ( 'Table'[Year(MM/DD/YYYY)] ),
        FILTER ( 'Table', YEAR ( 'Table'[Year(MM/DD/YYYY)] ) IN _SELECT_YEAR )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[FIValue] ),
        FILTER ( 'Table', 'Table'[Year(MM/DD/YYYY)] = _LAST_DAY )
    )

Result is as below.

If you select code "BEVH" and year 2015 it should display the value 94.

1.png

If you select code "BEVH" and select both the years 2015 and 2016  then it should display the value 95 

2.png

Best Regards,
Rico Zhou

 

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
Anonymous
Not applicable

Hi @Kavya123 ,

 

I suggest you to create an unrelated Year table for slicer. Then create a measure to calculate the latest date data based on selection.

Year Selection =
VAR _ADD =
    ADDCOLUMNS (
        VALUES ( 'Table'[Year(MM/DD/YYYY)] ),
        "Year", YEAR ( [Year(MM/DD/YYYY)] )
    )
VAR _SUMMARIZE =
    SUMMARIZE ( _ADD, [Year] )
RETURN
    _SUMMARIZE

Measure:

Latest date data = 
VAR _SELECT_YEAR =
    VALUES ( 'Year Selection'[Year] )
VAR _LAST_DAY =
    CALCULATE (
        MAX ( 'Table'[Year(MM/DD/YYYY)] ),
        FILTER ( 'Table', YEAR ( 'Table'[Year(MM/DD/YYYY)] ) IN _SELECT_YEAR )
    )
RETURN
    CALCULATE (
        SUM ( 'Table'[FIValue] ),
        FILTER ( 'Table', 'Table'[Year(MM/DD/YYYY)] = _LAST_DAY )
    )

Result is as below.

If you select code "BEVH" and year 2015 it should display the value 94.

1.png

If you select code "BEVH" and select both the years 2015 and 2016  then it should display the value 95 

2.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks a lot. It is working.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.