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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Agg after recent date

Hi everyone,

 

I have this table below that is connect to a Calendar Table.

 

Date

IDColumn1Column2
31/07/2021A1601060
31/08/2021A2001170
30/09/2021A1751300
31/07/2021B10150
31/08/2021B12200
30/09/2021B14250

 

I want to calculate two metrics. They have to show the most recent result, that is defined by a slicer based on the Calendar Table. The metrics are:

  • Total amount of column1
  • Total amount of column2

I am struggling with getting the most recent result. Let's say that my slicer goes from 1/Jun/2021 to 15/Sep/2021 I want a card that shows me:

  • Col1_A + Col1_B = 200+12 = 212
  • Col2_A + Col2_B = 1170+200 = 1370

Any ideas on how to lock the most recent available value and then sum per ID? Thanks

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @Anonymous 

Please try

Card1 =
SUMX (
VALUES ( 'Table'[ID] ),
MAXX ( CALCULATETABLE ( TOPN ( 1, 'Table', 'Table'[Date] ) ), 'Table'[Column1] )
)

View solution in original post

2 REPLIES 2
tamerj1
Community Champion
Community Champion

Hi @Anonymous 

Please try

Card1 =
SUMX (
VALUES ( 'Table'[ID] ),
MAXX ( CALCULATETABLE ( TOPN ( 1, 'Table', 'Table'[Date] ) ), 'Table'[Column1] )
)

Anonymous
Not applicable

@tamerj1 thanks, it worked perfectly!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.