Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
How do i use row_number function in power bi
Code is:-
DELETE Sub FROM
(SELECT ROW_NUMBER() over ( PARTITION BY PlantId,CustomerId,Customer,Date,FirmOrders,ShippedQty order by PlantId) cnt
FROM Shipped) Sub
WHERE Sub.cnt>1
This code is for deleting each duplicate row from a table
I have A table which have duplicate records in rowwise, how to remove each duplicate rows, and table doesn't have any primary key column.
for Example:-
PlantId | Year | Month | Target (MT) | Production (MT) |
1 | 2015 | 4 | 10080 | 5003 |
1 | 2015 | 5 | 11345 | 6010 |
1 | 2015 | 6 | 12610 | 7017 |
6 | 2015 | 7 | 20000 | 20000 |
1 | 2015 | 8 | 15140 | 9031 |
1 | 2015 | 9 | 12405 | 8038 |
1 | 2015 | 4 | 10080 | 5003 |
1 | 2015 | 5 | 11345 | 6010 |
1 | 2015 | 6 | 12610 | 7017 |
6 | 2015 | 7 | 20000 | 20000 |
1 | 2015 | 8 | 15140 | 9031 |
1 | 2015 | 9 | 12405 | 8038 |
@surya_gupta , Rank
new column
Rankx(filter(Table, [CustomerId] = earlier([CustomerId]) && [CustomerId] = earlier([CustomerId]) && [Customer] = earlier([Customer]) && [Date] = earlier([Date]) && [FirmOrders] = earlier([FirmOrders]) && [ShippedQty] = earlier([ShippedQty]) ), [PlantID],,asc,dense)
Then you can filter on that column
User | Count |
---|---|
54 | |
23 | |
19 | |
18 | |
17 |
User | Count |
---|---|
91 | |
87 | |
47 | |
30 | |
22 |