Oh, your year is a string so you need to put that in quotes and you need to make it aggregate like this:
If attr([year]) = "2018" then lookup(sum([sales]),last()) - lookup(sum([sales]),first()) end
it worked. thank you again for your time and help.
Welcome! If you don't mind, can you mark my last response or two as helpful? Thanks!
sorry how do I do that lol.