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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
NickzNickz
Helper IV
Helper IV

How to get the latest amount filter by year and month

Hi...

 

I have created the table below for our scenario purposes.

NickzNickz_0-1687760090860.png

and below is the measure I currently have to get the output but only get the latest last record ...
Filter by Year and Month

 

Latest Value Migration = 
VAR _Year = MAX(test_scenario_2[Year])
VAR _Month = MAX(test_scenario_2[Month])
VAR _Maxdate = MAXX(FILTER(test_scenario_2, test_scenario_2[Year] = _Year), test_scenario_2[Month] = _Month)
VAR _Result = MAXX(FILTER(test_scenario_2, test_scenario_2[Year] = _Year && test_scenario_2[Month] = _Month) , test_scenario_2[Migration])
Return
IF(ISBLANK(_Result),"0.00",_Result)

 

Anyone can help me to get the below result :

1)  Migration total sum for the latest year and month. The result should get = 1950

2) Please advise me if the measure can be a more simplified version or the table need an additional column...

 

 

Regards,

NickzNickz

 

2 ACCEPTED SOLUTIONS

@NickzNickz,

 

A date table would certainly be a good idea 🙂 Once created, you could simply sum the migration column, filtered on MAX( dateTable[Date] ).

View solution in original post

@NickzNickz,

 

More like this one:

 

Mesure = 
    CALCULATE(
        SUM( 'Table'[Migration] ),
        'Table'[Date] = MAX( 'Table'[Date] )
    )

 

Alf94_0-1687769749633.png

 

Best,

 

View solution in original post

5 REPLIES 5
Alf94
Solution Supplier
Solution Supplier

Hi @NickzNickz ,

 

Can you try the following?

 

Latest value migration =
VAR _year = MAX(test_scenario_2[Year])
VAR _month = MAX(test_scenario_2[Month])
RETURN
    SUMX(
        FILTER(
            test_scenario_2,
            test_scenario_2[Year] = _year && test_scenario_2[Month] = _month
        ),
        test_scenario_2[Migration]
    )

 

If I answered your question, please mark my post as a solution.

 

Best,

Hi @Alf94 ,

 

I have tested ... 

Scenario 1 - ok .. 
Scenario 2  - I add year 2023 and month 3 , result is empty as below ...

NickzNickz_0-1687765267716.png

Should I create date table and filter max from there ? ...

 

NickzNickz

 

@NickzNickz,

 

A date table would certainly be a good idea 🙂 Once created, you could simply sum the migration column, filtered on MAX( dateTable[Date] ).

@Alf94 ,

 

I have created date table as per your recommendation and below is the result.

NickzNickz_0-1687766855487.png

 

 

Latest Value Migration 3 = 
    SUMX(
        FILTER(
            test_scenario_2,test_scenario_2[Date] 
            = MAX(test_scenario_2[Date])
        ),
        test_scenario_2[Migration])

 


If I want to get only the last value, what should I change in the measure ? ...

 

NickzNickz

@NickzNickz,

 

More like this one:

 

Mesure = 
    CALCULATE(
        SUM( 'Table'[Migration] ),
        'Table'[Date] = MAX( 'Table'[Date] )
    )

 

Alf94_0-1687769749633.png

 

Best,

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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