Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

How do i use row number function in power bi

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

3 Replies

  • Anonymous , 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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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:-

     

    PlantIdYearMonthTarget (MT)Production (MT)
    120154100805003
    120155113456010
    120156126107017
    6201572000020000
    120158151409031
    120159124058038
    120154100805003
    120155113456010
    120156126107017
    6201572000020000
    120158151409031
    120159124058038