Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
surya_gupta
Frequent Visitor

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 3
surya_gupta
Frequent Visitor

surya_gupta
Frequent Visitor

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
amitchandak
Super User
Super User

@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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors