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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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