Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Data Example: Table1
Part # | Type | Date |
123 | A | 1/1/24 |
123 | B | 1/3/24 |
123 | A | 1/6/24 |
456 | B | 1/1/24 |
456 | B | 1/2/24 |
456 | A | 1/9/24 |
Desired Result: Table2
Part # | Variance |
123 | 2 |
456 | 1 |
Solved! Go to Solution.
Hi @graefs ,
I’ve made a test for your reference:
1\I assume there is a table(Table1)
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)
3\Create a new calculate table
NewTable = SUMMARIZE(Table1,Table1[Part],"Variance",SUM(Table1[TypeChange]))
Best Regards,
Bof
Hi @graefs ,
I’ve made a test for your reference:
1\I assume there is a table(Table1)
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)
3\Create a new calculate table
NewTable = SUMMARIZE(Table1,Table1[Part],"Variance",SUM(Table1[TypeChange]))
Best Regards,
Bof
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
39 | |
23 | |
21 | |
19 | |
10 |
User | Count |
---|---|
38 | |
36 | |
34 | |
20 | |
14 |