Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
48 | |
20 | |
18 | |
16 | |
15 |
User | Count |
---|---|
32 | |
19 | |
19 | |
16 | |
16 |