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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Mariollo
Regular Visitor

Log table - how to show what was changed

I have a log table like the white one below.

I would like to add a blue column which will indicate what was changed in previous row (previous LogId for each EntityID).

 

What is the easiest way to do this in PQ?

 

logtable.png

2 REPLIES 2
MAwwad
Super User
Super User

Or using Dax like this :

 

Changed = VAR CurrentRow = MIN(Table[LogId]) RETURN CALCULATE(MIN(Table[LogId]), Table[EntityID] = EARLIER(Table[EntityID]), Table[LogId] < CurrentRow)

MAwwad
Super User
Super User

 

  1. Create a custom column: Right-click on the log table in the Power Query Editor and select "New Source" > "Blank Query". In the new query, go to "Add Column" > "Custom Column", enter a name for the new column, and enter the following formula:

= List.Last(List.Select(List.Sort([EntityID]), each [EntityID] = [EntityID]))
  1. Close & Load the new query to your worksheet. The new custom column will show what was changed in the previous row for each EntityID.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.