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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
krzysztof
Helper III
Helper III

Last exchange rate

I have a problem with dax in Power Query:
Where null is empty, the new column finds the last course after the date assigned to the corresponding column
The expected effect is the "target column"

1.png

PBIX: https://drive.google.com/file/d/1Ywet6f7_poEBmynvGySCMHplnNo3lifV/view?usp=sharing 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @krzysztof ,

You can create a calculated column as below to get it, please find the details in the attachment.

Target Column = 
VAR _date = 'Tabela'[Date]
VAR _currency = 'Tabela'[Currency]
VAR _predate =
    CALCULATE (
        MAX ( 'Tabela'[Date] ),
        FILTER (
            'Tabela',
            'Tabela'[Date] < _date
                && 'Tabela'[Currency] = _currency
                && 'Tabela'[Exchange rate] <> BLANK ()
        )
    )
VAR _preerate =
    CALCULATE (
        MAX ( 'Tabela'[Exchange rate] ),
        FILTER ( 'Tabela', 'Tabela'[Date] = _predate && 'Tabela'[Currency] = _currency )
    )
RETURN
    IF ( ISBLANK ( 'Tabela'[Exchange rate] ), _preerate, 'Tabela'[Exchange rate] )

vyiruanmsft_0-1718938617841.png

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @krzysztof ,

You can create a calculated column as below to get it, please find the details in the attachment.

Target Column = 
VAR _date = 'Tabela'[Date]
VAR _currency = 'Tabela'[Currency]
VAR _predate =
    CALCULATE (
        MAX ( 'Tabela'[Date] ),
        FILTER (
            'Tabela',
            'Tabela'[Date] < _date
                && 'Tabela'[Currency] = _currency
                && 'Tabela'[Exchange rate] <> BLANK ()
        )
    )
VAR _preerate =
    CALCULATE (
        MAX ( 'Tabela'[Exchange rate] ),
        FILTER ( 'Tabela', 'Tabela'[Date] = _predate && 'Tabela'[Currency] = _currency )
    )
RETURN
    IF ( ISBLANK ( 'Tabela'[Exchange rate] ), _preerate, 'Tabela'[Exchange rate] )

vyiruanmsft_0-1718938617841.png

Best Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.