Forum Discussion
Anonymous
2 years agoNot applicable
Duplicate Value Count
Dear All , I want to get the count of the duplicate values as shown below. Below shows my table. Predecessr FollOn Doc 1030172720 1200261222 1030172740 1200261228 1030172...
- 2 years ago
ALLSELECTED has no meaning in a calculated colum. You can also drop the OrderBy.
Count2 = ROWNUMBER(SUMMARIZE('Table',[Predecessr],[FollOn Doc]),PARTITIONBY([Predecessr]))
lbendlin
2 years agoSuper User
Power BI has no concept of row numbers. You need to bring your own index.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc+5DcAwDAPAVQLVLiha8jOL4f3XCFIpCuL6QJBcSxQV2tkJKaIE2JSk7BJmycbRzPRow+vJiOn/5jT6x2bkKvIW15cpsrXY0sbMNsK65g/+9F2y9w0=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Predecessr = _t, #"FollOn Doc" = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Count", (k)=> Table.RowCount(Table.SelectRows(#"Added Index",each [Index]<=k[Index] and [Predecessr]=k[Predecessr])))
in
#"Added Custom"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".