Forum Discussion
Column with TOTALYTD
Hi,
I need a column (or a different new table but not a measure) with the total amount € for each account from 1 january to 31 december previous year, like:
account amount
1 1.200€
2 20.000€
...
the table I have has the following column
account date amount
1 03/04/2020 1000€
1 11/12/2020 200€
...
I require a column because I need to sum the amount previous year for each account to the amount current year, see my previous post still not solved: Adding total sum previous year in a column
Thanks,
Luca2020 , This will a year behind column
new column =
var _date = date(year([date])-1,month([date]),day([date]))
return
sumx(filter(Table, [date] =_date &&[account] = earlier([account])),[amount] )in case you want to sum up last year till date
new column =
var _max = date(year([date])-1,month([date]),day([date]))
var _min = date(year([date])-1,1,1)
return
sumx(filter(Table, [date] >=_min && [date]<=_max &&[account] = earlier([account])),[amount] )
1 Reply
- amitchandakSuper User
Luca2020 , This will a year behind column
new column =
var _date = date(year([date])-1,month([date]),day([date]))
return
sumx(filter(Table, [date] =_date &&[account] = earlier([account])),[amount] )in case you want to sum up last year till date
new column =
var _max = date(year([date])-1,month([date]),day([date]))
var _min = date(year([date])-1,1,1)
return
sumx(filter(Table, [date] >=_min && [date]<=_max &&[account] = earlier([account])),[amount] )