The error you get strongly depends on how you are evaluating your formula, that's why it might work on another table but not on this one. As @JBfreefolks pointed out correctly you are specifying a column where a scalar value is expected. That can work depending on the context you are evaluating your formula over (assuming it is a measure).
For instance, imagine a data-set with 100 rows equally divided into four categories A,B,C,D. When you create a table visual with a row for each category, each row will have 25 underlying records that will be used in any calculation added to this row (either a measure or an aggregate of any value). This means that when using a formula like datediff with a column reference, it will get 25 values for it's second argument where it expects one.
There are several ways to solve the problem depending on your desired result.
Use a measure like MAX like @JBfreefolks suggested to make sure that a single value is selected from multiple values. The measure will still be calculated over a group of records but will summarize it by taking the maximum date.
Make sure the visual you are using has something like an ID in there so it doesn't group, it displays row context. Any measure added to this visual will evaluate in row context as well.
Use a calculated column instead. They are always evaluated in row context first and their values can be aggregated in a visual later on. When using TODAY()
, you probably need to refresh your report at least every day to keep the column up to date.
A more complicated way is to use an iterator like SUMX()
or AVERAGEX()
to force row context evaluation inside of a measure.
Good to see you solved it already, still posting as it might be helpful to others.