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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.