最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

date - A table of multiple values was supplied where a single value was expected YTD - Stack Overflow

programmeradmin0浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

In 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"
)
发布评论

评论列表(0)

  1. 暂无评论