Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Prasadmohan
Frequent Visitor

Scalar Value Error

Hello Any one can help error " The expression refers to multiple columns.Multiple columns cannot be converted to a scalar value"

 

Dax formula below

1 MTDYTD =
2 var TodayDate = TODAY()
3 var YearStart = CALCULATE(STARTOFYEAR(FactGlTran[Month Year]),YEAR(FactGlTran[Month Year]) = YEAR(TodayDate) )
4 var QuarterStart = CALCULATE(STARTOFYEAR(FactGlTran[Month Year]),YEAR(FactGlTran[Month Year]) = YEAR(TodayDate),QUARTER(FactGlTran[Month Year]) = QUARTER(TodayDate) )
5 var MonthStart = CALCULATE(STARTOFMONTH(FactGlTran[Month Year]),YEAR(FactGlTran[Month Year]) = YEAR(TodayDate),MONTH(FactGlTran[Month Year]) = MONTH(TodayDate) )
6 var Result =
7 UNION (
ADDCOLUMNS(
9      CALENDAR(YearStart,TodayDate),
10       "Selection", "YTD"
11  ),
12   ADDCOLUMNS(
13      CALENDAR(MonthStart,TodayDate),
14        "Selection","MTD"
15   ),
16  ADDCOLUMNS(
17      CALENDAR(QuarterStart,TodayDate),
18    "Selection", "QTD"
19  )
20 )
21 Return
22 Result
 
Best regards
Prasad

 

1 REPLY 1
lbendlin
Super User
Super User

Measures can use table variables during processing but can only return a single value at the end.  Your code tries to return a table.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.