I am trying to calculate a table where I can see the YTD values with this DAX:
Is YTD =
IF (
'Append'[Attribute - Date] >= DATE ( YEAR ( DISTINCT ( 'Append'[Date Ref.EoMonth] ) ), 1, 1 )
&& 'Append'[Attribute - Date] <= DISTINCT ( 'Append'[Date Ref.EoMonth] ),
"YTD",
"Other"
)
But I get A table of multiple values was supplied where a single value was expected
I am trying to calculate a table where I can see the YTD values with this DAX:
Is YTD =
IF (
'Append'[Attribute - Date] >= DATE ( YEAR ( DISTINCT ( 'Append'[Date Ref.EoMonth] ) ), 1, 1 )
&& 'Append'[Attribute - Date] <= DISTINCT ( 'Append'[Date Ref.EoMonth] ),
"YTD",
"Other"
)
But I get A table of multiple values was supplied where a single value was expected
Share Improve this question edited Nov 20, 2024 at 14:37 Amira Bedhiafi 1 asked Nov 20, 2024 at 10:35 Yolanda CBYolanda CB 156 bronze badges1 Answer
Reset to default 0In your case DISTINCT returns a table of values but DAX expects a single value for comparison in your IF statement. Try to use MAX or MIN to get a single value returned from 'Append'[Date Ref.EoMonth] which DAX can use for comparison :
Is YTD =
IF (
'Append'[Attribute - Date] >= DATE ( YEAR ( MAX ( 'Append'[Date Ref.EoMonth] ) ), 1, 1 )
&& 'Append'[Attribute - Date] <= MAX ( 'Append'[Date Ref.EoMonth] ),
"YTD",
"Other"
)