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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ZealandZu
Frequent Visitor

Seeing what changes to employee records have happened

Hi. Im trying to figure out how I get a employee history table which has multiple rows per employee due to when a change has been made to their records. Below is a example of some of the types of columns. However in reality there are about 60 columns that could be altered. Note this is sample data and not real

 

SurnameForenameEmployee#Pay#CountryLocationBusinessStatusHire DateTermination DateChanged Date
BloggsJoe123458888UKSouthBMWA01/01/2000null01/01/2000
BloggsJoe123458888UKSouthFordA01/01/2000null05/06/2015
BloggsJoe123458888UK

North

SkodaA01/01/2000null06/07/2016
BloggsJoe1234512345UKNorthSkodaA01/01/2000null07/07/2017
WhiteBen121217885UKSouthFordA05/06/2006null05/06/2006
WhiteBen1212112121UKSouthFordA05/06/2006null07/07/2017
WhiteBen1212112121UKSouthFordT05/06/200608/09/202008/09/2020

 

Basically, the end result i need is that if i select Joe Bloggs in a slicer, i want to be able to see all of the changes that have been made (ps i know how to concatenate the employee name). Im assuming i need to do some sort of unpivotting, indexing etc however im stumped as to what to do for this one.

 

EmployeeChanged FieldNew RecordDate of Change
Joe BloggsHire Date01/01/200001/01/2000
Joe BloggsBusinessFord05/06/2015
Joe BloggsLocationNorth06/07/2016
Joe BloggsBusinessSkoda06/07/2016
Joe BloggsPay#1234507/07/2017

 

Many thanks

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @ZealandZu,

You can do unpivoted column on your table fields(Pay#, Business, Location) which you want to trace.

Unpivot columns - Power Query | Microsoft Learn

1.png

Then you can write measure formula to check the change between current and previous date and return flag.

 

Change Flag = 
VAR currDate =
    MAX ( 'Table'[Changed Date] )
VAR prevDate =
    CALCULATE (
        MAX ( 'Table'[Changed Date] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Changed Date] < currDate ),
        VALUES ( 'Table'[Forename] ),
        VALUES ( 'Table'[Surname] )
    )
VAR currValue =
    SELECTEDVALUE ( 'Table'[Value] )
VAR prevValue =
    CALCULATE (
        MAX ( 'Table'[Value] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Changed Date] = prevDate ),
        VALUES ( 'Table'[Forename] ),
        VALUES ( 'Table'[Surname] ),
        VALUES ( 'Table'[Attribute] )
    )
RETURN
    IF ( prevDate <> BLANK (), IF ( currValue <> prevValue, "Y", "N" ), "N" )

 

After these steps, you can create a table visual with category and correspond fields and use measure as filter to filter not matched records.

2.png
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @ZealandZu,

You can do unpivoted column on your table fields(Pay#, Business, Location) which you want to trace.

Unpivot columns - Power Query | Microsoft Learn

1.png

Then you can write measure formula to check the change between current and previous date and return flag.

 

Change Flag = 
VAR currDate =
    MAX ( 'Table'[Changed Date] )
VAR prevDate =
    CALCULATE (
        MAX ( 'Table'[Changed Date] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Changed Date] < currDate ),
        VALUES ( 'Table'[Forename] ),
        VALUES ( 'Table'[Surname] )
    )
VAR currValue =
    SELECTEDVALUE ( 'Table'[Value] )
VAR prevValue =
    CALCULATE (
        MAX ( 'Table'[Value] ),
        FILTER ( ALLSELECTED ( 'Table' ), [Changed Date] = prevDate ),
        VALUES ( 'Table'[Forename] ),
        VALUES ( 'Table'[Surname] ),
        VALUES ( 'Table'[Attribute] )
    )
RETURN
    IF ( prevDate <> BLANK (), IF ( currValue <> prevValue, "Y", "N" ), "N" )

 

After these steps, you can create a table visual with category and correspond fields and use measure as filter to filter not matched records.

2.png
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thankyou so much. You are a genius

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.