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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Operacoes
Regular Visitor

Handle latest values ​​by group

Hi guys,

I needed to sum up the most recent values ​​per person, I found the last date function which resolves that part of the recent value. But it only takes the most recent value from everyone, how do I segment this by group?

I'm putting a print of an example table and when trying to get the most recent value if the category is radar it returns 8 (which is not wrong)

But I wanted it to return 16, most recent 8 from one person with the most recent 8 from another for radar category.

Operacoes_0-1646831444122.png

 

 

 

7 REPLIES 7
johnt75
Super User
Super User

The below will give the sum of the latest values for each category

most recent = SUMX(
ADDCOLUMNS( SUMMARIZE( 'Table', 'Table'[Pessoa], 'Table'[Ferramenta]), "@recent val",
SELECTCOLUMNS( CALCULATETABLE( TOPN( 1, 'Table', 'Table'[Data], desc) ), "@val", 'Table'[Nota])
),
[@recent val]
)

It's a start, i tried to simplify but my real problems is to count if the recent grade by tool is in one of the ranges: 

 

0 to 6

7 to 8

and 9 to 10

 

For my table in example, to tool Radar we have 1 in 7 to 8 (most recent for Du) and another 1 in 7 to 8 (most recent for Mateus)... to tool Propósito we have 1 in 0 to 6 (most recent for Du) and another 1 in 9 to 10 (most recent for Mateus)

 

Do you think it is possible?

I think you would need separate measures for each grouping, but they would give values down to the ferramenta level. e.g.

Most recent 1-7 =
var summaryTable = ADDCOLUMNS(
   SUMMARIZE( 'Table', 'Table'[Pessoa], 'Table'[Ferramenta]), "@recent val",        
   SELECTCOLUMNS( CALCULATETABLE( TOPN( 1, 'Table', 'Table'[Data], desc) ), "@val", 'Table'[Nota] 
)
var result = COUNTROWS( FILTER( summaryTable, [@recent val] >= 1 && [@recent val] <= 7 ) )

The summaryTable variable would be the same in all measures, you'd just need to change the boundaries

 

I've got this error, already checked about missing ")" and didnt find 

Operacoes_0-1646840969854.png

 

my mistake, forgot to add a RETURN statement. just add

return result

at the end

amitchandak
Super User
Super User

@Operacoes , Try a measure like

 

Measure =
VAR __id = MAX ('Table'[pessoa] )
VAR __date = CALCULATE ( MAX('Table'[Data] ), ALLSELECTED ('Table' ), 'Table'[pessoa] = __id )
CALCULATE (Sum(Table[Nota]), VALUES ('Table'[pessoa] ),'Table'[pessoa] = __id,'Table'[Data] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi, thanks for help but didn't solve yet

 

Max('Table'[pessoa]) will return Mateus, right? but I need the most recent answers for all pairs (Pessoa (subject) and Ferramenta (Tool))

In other words, when I work on tool "Radar" I need to sum the most recent grade for every subject in this tool, am i clear?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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