Forum Discussion
How to calculate rows on a table?
How to calculate rows on a table? I want to create a column "started" as below, for each row of this column I need the result of this excel like formula: =IF(AND(A3=A2;B3-B2<1);"No";"yes")
| part | install date | started |
| PAU-0101 | 26/03/2019 05:17 | yes |
| PAU-0101 | 07/04/2019 18:56 | No |
| PAU-0101 | 07/04/2019 19:56 | yes |
| PAU-0102 | 26/03/2019 05:17 | yes |
| PAU-0102 | 07/04/2019 18:56 | No |
| PAU-0102 | 07/04/2019 19:56 | yes |
2 Replies
- stvsurf
Resolver I
you can edit your table in power query:
#"Sorted Rows" = Table.Sort(#"Changed Type",{ {"part", Order.Ascending},{"install date", Order.Ascending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1),
#"Added Custom" = Table.AddColumn(#"Added Index", "next part", each #"Added Index"{[Index]+0}[part]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "next date", each #"Added Custom"{[Index]+0}[install date]),
#"Added Conditional Column" = Table.AddColumn(#"Added Custom1", "check", each if [part] = [next part] and Date.AddDays([install date],1) > [next date] then "NO" else "YES"),
#"Replaced Errors" = Table.ReplaceErrorValues(#"Added Conditional Column", {{"check", "YES"}})I'm sure there is an way to do this with less lines... but at least this should do the trick
- amitchandak
Super User
edgarjb-68 , try like
Column = var _next = minx(filter(Sheet1,[part] =EARLIER([part]) && [install date] >EARLIER(Sheet1[install date])),[install date]) return if(DATEDIFF([install date],_next,day)<1 && NOT(ISBLANK(DATEDIFF([install date],_next,day))),"No","Yes")File attached after signature