"token eof expected" error in power query

DUBAU, Marius (IMT Mines Albi) 0 Reputation points
2023-05-10T09:04:37.61+00:00

Hello all,

I have a bunch of production values and my goal is to sort out the hourly production, for that I need to substract values in different rows but in the same column

`| Hour | Machine | Production |

| 00:00| 10303 | 3

| 00:00| 10305 | 16

| 00:00| 10308 | 1

| 00:00| 10500 | 134

| 01:00| 10303 | 3

| 01:00| 10305 | 18

| 01:00| 10308 | 3

| 01:00| 10500 | 134`

basically I want to substract production value of machine 10303 at 1am and value at 0am, then 2am - 1am, etc... and this for all 4 machines

I have this code that I put in power query's advanced editor but it keeps saying "token eof expected", can someone spot what I missed ? (it says the error is on the comma just above #"Expanded Difference")

`#"Grouped Rows" = Table.Group(#"Previous step", {"Machine"}, {

{"Difference", (t) => Table.AddColumn(t, "Difference", each

if t[Production]{4} - t[Production]{1} < 0 then null

else if t[Valeur]{4} - t[Valeur]{1} >= 0 then t[Valeur]{4} - t[Valeur]{1}

else null,

Decimal.Type)

}

}),

#"Expanded Difference" = Table.ExpandTableColumn(#"Grouped Rows", "Difference",

{"Production", "Difference"})

in

#"Expanded Difference"`

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,794 questions
0 comments No comments
{count} votes