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
graefs
Frequent Visitor

Tracking Changes under Unique ID

Data Example: Table1

Part #TypeDate

123

A1/1/24
123B1/3/24
123A1/6/24
456B1/1/24
456B1/2/24
456A1/9/24

 

Desired Result: Table2

Part #Variance
1232
4561
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @graefs ,

 

I’ve made a test for your reference:

1\I assume there is a table(Table1)

vbofengmsft_0-1726193652361.png

 

2\Add a new column for Table1

TypeChange =

VAR CurrentType = 'Table1'[Type]

VAR PreviousType =

    CALCULATE(

        MAX('Table1'[Type]),

        FILTER(

            'Table1',

            'Table1'[Part] = EARLIER('Table1'[Part]) &&

            'Table1'[Date] < EARLIER('Table1'[Date])

        )

    )

RETURN IF(CurrentType <> PreviousType && NOT(ISBLANK(PreviousType)), 1, 0)

vbofengmsft_1-1726193652365.png

3\Create a new calculate table

NewTable = SUMMARIZE(Table1,Table1[Part],"Variance",SUM(Table1[TypeChange]))

vbofengmsft_2-1726193663301.png

 

 

Best Regards,

Bof

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @graefs ,

 

I’ve made a test for your reference:

1\I assume there is a table(Table1)

vbofengmsft_0-1726193652361.png

 

2\Add a new column for Table1

TypeChange =

VAR CurrentType = 'Table1'[Type]

VAR PreviousType =

    CALCULATE(

        MAX('Table1'[Type]),

        FILTER(

            'Table1',

            'Table1'[Part] = EARLIER('Table1'[Part]) &&

            'Table1'[Date] < EARLIER('Table1'[Date])

        )

    )

RETURN IF(CurrentType <> PreviousType && NOT(ISBLANK(PreviousType)), 1, 0)

vbofengmsft_1-1726193652365.png

3\Create a new calculate table

NewTable = SUMMARIZE(Table1,Table1[Part],"Variance",SUM(Table1[TypeChange]))

vbofengmsft_2-1726193663301.png

 

 

Best Regards,

Bof

 

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 Fabric 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.