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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Kym01
Frequent Visitor

Expression Refers to Multiple Columns Error when FILTER put inside Switch

I have a table containing different dates (dateARInitiateComplete,  dateARScreenComplete, dateARCloseComplete).  These values need to be sent to the filter and then returned in the calculated table as Complete.  The code works fine so long as I'm only using one condition (First Example).  When I add Switch (Example 2), I get  the error message "The expression refers to multiple columns.  Multiple columns cannot be converted to a scalar value".   I can't figure out how to switch out one column name for another to be able to filter the specific column selected.

 
Example 1 - working
TesttblVarvDateField =
VAR vBeg = EDATE ( TODAY(), -1 )
VAR vEnd = EOMONTH ( TODAY(), -1 )
VAR vSelected = SELECTEDVALUE(lkupWorkFlowSteps[agDescription])
var vFilter =
      FILTER
        (
           'tblCR',
           'tblCR'[DateARScreenComplete] >= vBeg &&
           'tblCR'[DateARScreenComplete] <= vEnd
        )
 
RETURN
 ADDCOLUMNS
(
   SUMMARIZE
    (
     vFilter,
           'tblCR'[FSA],
            'tblCR'[iCASNumber],
            'tblCR'[DateARScreenComplete]
    ),
        "Complete", 'tblCR'[DateARScreenComplete]
)

 



 

Example 2 - not working
TesttblVarvDateField =
VAR vBeg = EDATE ( TODAY(), -1 )
VAR vEnd = EOMONTH ( TODAY(), -1 )
VAR vSelected = SELECTEDVALUE(lkupWorkFlowSteps[agDescription])
var vFilter =
SWITCH
(
   TRUE(),
   vSelected = "AR INITIATE",
      FILTER
        (
           'tblCR',
           'tblCR'[DateARScreenComplete] >= vBeg &&
           'tblCR'[DateARScreenComplete] <= vEnd
        )
  )
RETURN
 ADDCOLUMNS
(
   SUMMARIZE
    (
     vFilter,
           'tblCR'[FSA],
            'tblCR'[iCASNumber],
            'tblCR'[DateARScreenComplete]
    ),
        "Complete", 'tblCR'[DateARScreenComplete]
)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Kym01 ,

 

Dax function can include a calculated table in the measure, but Measure outputs a single value, your dax function outputs a table or a whole column of values, so that's why you get that error.

 

You can consider using CALCULATETABLE or you can consider using MAXX() similar aggregation function + Filter() function to combine the output of the value you want, you can try to explain what kind of result you want to output in the measure, share sample data and sample output in table format? Or sample pbix after removing sensitive data. We can better understand what the problem is and help you.

 

This is the related document, you can view this content:

Solved: The expression refers to multiple columns. Multipl... - Microsoft Fabric Community

Solved: The expression refers to multiple columns. Multipl... - Microsoft Fabric Community

Solved: The expression refers to multiple columns. Multipl... - Microsoft Fabric Community

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Kym01 ,

 

Dax function can include a calculated table in the measure, but Measure outputs a single value, your dax function outputs a table or a whole column of values, so that's why you get that error.

 

You can consider using CALCULATETABLE or you can consider using MAXX() similar aggregation function + Filter() function to combine the output of the value you want, you can try to explain what kind of result you want to output in the measure, share sample data and sample output in table format? Or sample pbix after removing sensitive data. We can better understand what the problem is and help you.

 

This is the related document, you can view this content:

Solved: The expression refers to multiple columns. Multipl... - Microsoft Fabric Community

Solved: The expression refers to multiple columns. Multipl... - Microsoft Fabric Community

Solved: The expression refers to multiple columns. Multipl... - Microsoft Fabric Community

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.