Forum Discussion
antuneslucas
2 years agoFrequent Visitor
Create new column based on criteria and previous value
I'm trying to create a column that displays the case id of each event based on Time column. Each time column Time has a value, it incriment one in the case id. Original table: Description ...
- 2 years ago
in DAX
=CALCULATE(COUNT(Table3[Time]),'Table3'[Time]<>0,ALLSELECTED(Table3[Description]))-CALCULATE(COUNT(Table3[Time]),'Table3'[Time]<>0,ALLSELECTED(Table3[Description]),'Table3'[Description]>=MAX('Table3'[Description]))+1in M
let Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content], Custom1 = let a=List.Buffer(Source[ Time]) in List.Generate(()=>{1,0},each _{1}<Table.RowCount(Source),each {_{0}+Byte.From(a{_{1}}<>null),_{1}+1},each _{0}), Custom2 = Table.FromColumns(Table.ToColumns(Source)&{Custom1},Table.ColumnNames(Source)&{"CaseID"}) in Custom2
Syndicate_Admin
Administrator
2 years agoAdd an index column to disambiguate.