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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
NickzNickz
Helper IV
Helper IV

Get latest value and latest sum value based on year and month

Hi ... 

I attached herewith the sample I have used for the testing environment :

 

Scenario #1

YearMonthNewMigration
20213123123
20216234345
20219456567
202112678789
20223234321
20226345432
20229456543
202212567654

 

Scenario #2

StateYearMonthNewMigration
A20213123123
B20213234345
C20213456567
D20213678789
A20226234321
B20226345432
C20226456543
D20226567654

 

How can I achieve the below results:

 

Scenario #1:

How can I get the latest value based on year and month for New and Migration?

 

Scenario #2:

How can I get the latest value (sum) based on year and month for New and Migration?

 

 

Thank you and advance.

Regards,

NickzNickz

1 ACCEPTED SOLUTION

@devanshi ,

 

I have made some changes to the measure based on conversion with others:

Latest Group Value Migration Final = 
// Get total amount
VAR _Result =
    SUMX(
        FILTER(
            test_scenario_2,test_scenario_2[Date] 
            = MAX(test_scenario_2[Date])
        ),
        test_scenario_2[Migration]
    )
RETURN
IF(ISBLANK(_Result),"0.00",_Result)

 

 

Latest Value Migration Final = 
// Get the last amount
VAR _Result = CALCULATE(
        SUM( test_scenario_3[Migration] ),
        test_scenario_3[Date] = MAX( test_scenario_3[Date] )
    )
RETURN
IF(ISBLANK(_Result),"0.00",_Result)

 

Regards,

NickzNickz

 

 

View solution in original post

4 REPLIES 4
devanshi
Helper V
Helper V

Scenario1 :
MaxDate = MAX('Table'[Date])

LatestNewValue = CALCULATE( MAX('Table'[Value]), ALLEXCEPT('Table'[New], 'Table'[Date] = [MaxDate]) ) LatestMigrationValue = CALCULATE( MAX('Table'[Value]), ALLEXCEPT('Table'[Migration], 'Table'[Date] = [MaxDate]) )

Scenario2:

MaxDate = MAX('YourTable'[Date])

LatestNewSum = CALCULATE( SUM('Table'[Value]), ALLEXCEPT('Table'[New], 'Table'[Date] = [MaxDate]) ) LatestMigrationSum = CALCULATE( SUM('Table'[Value]), ALLEXCEPT('Table'[Migration], 'Table'[Date] = [MaxDate] ))

Hi @devanshi ,

 

I have changed the data in the table and below is the measure  :

NickzNickz_0-1687744388064.png

 

 

 

Max Date = MAX(test_scenario_2[Date])

 

 

 

Latest Value Test = CALCULATE(MAX(test_scenario_2[Migration]),ALLEXCEPT(test_scenario_2, test_scenario_2[Date] = [Max Date]))

 

 

 

 I tried to match the measure with yours but I couldn't get .... 
 
 

@devanshi ,

 

I have made some changes to the measure based on conversion with others:

Latest Group Value Migration Final = 
// Get total amount
VAR _Result =
    SUMX(
        FILTER(
            test_scenario_2,test_scenario_2[Date] 
            = MAX(test_scenario_2[Date])
        ),
        test_scenario_2[Migration]
    )
RETURN
IF(ISBLANK(_Result),"0.00",_Result)

 

 

Latest Value Migration Final = 
// Get the last amount
VAR _Result = CALCULATE(
        SUM( test_scenario_3[Migration] ),
        test_scenario_3[Date] = MAX( test_scenario_3[Date] )
    )
RETURN
IF(ISBLANK(_Result),"0.00",_Result)

 

Regards,

NickzNickz

 

 

Hi @devanshi ,

 

1)  'Table'[Value] is a table name ? ...

2) If I have only year and month column, what should I do with MAX('Table'[Date]) ?

 

Regards,

NickzNickz

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.