March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hi,
I have a table, with so many rows and coloumns,
i need to create a calculate coloumn, to segregate "Original and Duplicate entries"
Certain coloumns
GlobalService
DunsNumber
OpportunityID
Opportunity
PipelineOpen_constant
if the above coloumns , for the lines(Rows) are equal, then mark these as duplicate, except 1line(which is original)
that means if there are 3 lines same, mark 2 of them as duplicate and 1 as original.
let me know if this is possible to do and also i want a table to be created for those entries.
Solved! Go to Solution.
Hi @vjnvinod ,
I have created a sample for your reference, please check the following steps as below.
1. Insert an index column in power query. M code for your reference.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlSK1YGRSUhkMg4yBUymgsk0pdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [catgeory = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"catgeory", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1)
in
#"Added Index"
2. Close and apply, then wen can get the excepted result by a calculated column.
Column =
VAR inde = 'Table'[Index]
VAR previous = inde - 1
RETURN
IF (
CALCULATE (
MAX ( 'Table'[catgeory] ),
FILTER ( 'Table', 'Table'[Index] = previous )
) = 'Table'[catgeory],
"Duplicated",
"Original"
)
Pbix as attached.
Hi @vjnvinod ,
I have created a sample for your reference, please check the following steps as below.
1. Insert an index column in power query. M code for your reference.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSlSK1YGRSUhkMg4yBUymgsk0pdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [catgeory = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"catgeory", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1)
in
#"Added Index"
2. Close and apply, then wen can get the excepted result by a calculated column.
Column =
VAR inde = 'Table'[Index]
VAR previous = inde - 1
RETURN
IF (
CALCULATE (
MAX ( 'Table'[catgeory] ),
FILTER ( 'Table', 'Table'[Index] = previous )
) = 'Table'[catgeory],
"Duplicated",
"Original"
)
Pbix as attached.
Hi @vjnvinod ,
This is achievable.
Concatenate =
//you may also use "&" instead of COMBINEVALUES() to concatenate text strings
COMBINEVALUES (
" ",
'Table'[GlobalService],
'Table'[DunsNumber],
'Table'[OpportunityID],
'Table'[Opportunity],
'Table'[PipelineOpen_constant]
)
KeepThisRow = CALCULATE ( MIN ( 'Table'[Index/DateTimeStamp] ), ALLEXCEPT ( 'Table', 'Table'[Concatenate] ) ) = 'Table'[Index/DateTimeStamp]
Another way to do this, you don't want to keep all other rows except the first one based on several columns is do Remove Duplicates in Power Query which is very similar to Excel. In Power Query, select all the columns in your list. Right click and then select Remove Duplicates.
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
132 | |
90 | |
88 | |
64 | |
58 |
User | Count |
---|---|
203 | |
141 | |
107 | |
73 | |
70 |