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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
AndreiaCoelho
Regular Visitor

Calculate data within a grouping

Hey, guys!

I've been trying to find a solution to my problem for months.

I have a history of grades assigned by different users (NPS Survey) and I would like to measure the evolution of these grades. I have 3 main data:

1. Respondent's email
2. Grade assigned
3. Response date

I grouped the data by user as in the image

Example pbi.png

expanding the table for user "Marco", we see that he responded 3 times throughout his journey.

 

I need to take your last note (most recent note) and compare it to the penultimate note... how to do that?

 

I managed to pull the last note by the formula

= Table.AddColumn(#"Linhas Agrupadas1", "Personalizar", each Table.Max([Usuário], "Data da criação"))

but I have no idea how to pull the penultimate...

 

another solution that helps me is: make an average of all user grades.

1 REPLY 1
Anonymous
Not applicable

Hi,

 Probably not the most efficent solution but you could take your data table and get the date with the penultimate dates then use this to get the grade?

 

= Table.Group(#"Changed Type", {"Email", "Name"}, {{"PenultimateGrade", each List.Sort([Date],Order.Ascending){1}, type nullable date}})

 

From this

JamesRobson_0-1670607164550.png

 

To this

JamesRobson_1-1670607188870.png

 

It'll take a bit of work after that to merge back in etc but should be a good jump off point for you.

 

Thanks,

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors