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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.