Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

I have created measure:
Q3 TEST3 = CALCULATE(COUNTROWS ('Q3'),FILTER(FILTER(Q3,Q3[Facility Name]=SELECTEDVALUE(Demographics[Facility Name])),ALLEXCEPT(Q3,Q3[Gender])))
 
It pop up the error: 
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
 
Anyone know how should i modify?

1 Reply

  • AllisonKennedy's avatar
    AllisonKennedy
    Icon for Community Champion rankCommunity Champion

      What are you trying to achieve?  

    You have used the FILTER function twice. The filter argument in the filter function should be a true / false expression - you've used a calculate modifier ALLEXCEPT which can only be used in the calculate function. 

     

    Here's your expression formatted using DAXformatter.com to make it more clear: 

     

     

     

    Try either:

     

     

    Q3 TEST3 =
    CALCULATE (
        COUNTROWS ( 'Q3' ),
        FILTER ( Q3, Q3[Facility Name] = SELECTEDVALUE ( Demographics[Facility Name] ),
        ALLEXCEPT ( Q3, Q3[Gender] )
    )

     

    Or try:

     

    Q3 TEST3 =
    CALCULATE (
    COUNTROWS ( 'Q3' ),
    FILTER (
    ALLEXCEPT ( Q3, Q3[Gender] ),
    Q3[Facility Name] = SELECTEDVALUE ( Demographics[Facility Name] )
    )
    )

     

     

     

    Anonymous