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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
hosea_chumba
Helper I
Helper I

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

Kindly assist on the below;
I get the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"  when i input the below formula to create a column. How do i solve it.
Inadequately secured loans =
VAR _inadequate_security = CALCULATE(FILTER('Table1','Table1'[Collateral Amount] < 1.5*'Table1'[Loan Amount]
 && 'Table1'[Product ID] <> {2222,8888}))
VAR _result_ = SWITCH(TRUE(),
_inadequate_security,"Inadeqaute Security",
"Adequate Security")
RETURN
_result_
 
Objective is to identify transactions that have collateral value that are not at least 150% of the loan amount excluding product 2222 and 8888
1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

It's possible to have calculated tables inside a measure but if you want to return a table, then you need to use CALCULATETABLE rather than CALCULATE. However, since you are using _inadequate_security_ inside a SWITCH as if it is True/False, I suspect that you meant to have an argument in CALCULATE other than the filter table.

 

Did you intend to write something like this? (Note the line before FILTER.)

Inadequately secured loans =
VAR _inadequate_security =
    CALCULATE (
        ISEMPTY ( 'Table1' ),
        FILTER (
            'Table1',
            'Table1'[Collateral Amount] < 1.5 * 'Table1'[Loan Amount]
                && NOT ( 'Table1'[Product ID] IN { 2222, 8888 } )
        )
    )
VAR _result_ =
    SWITCH (
        TRUE (),
        _inadequate_security, "Inadeqaute Security",
        "Adequate Security"
    )
RETURN
    _result_

 

View solution in original post

5 REPLIES 5
vatsal96
New Member

I am getting the same problem 

12_Months =
VAR CurrentMonth = MAX('date'[Month Name])
VAR PriviousMonth = DATE(YEAR(CurrentMonth), MONTH(CurrentMonth)-12, DAY(CurrentMonth))
VAR Result =
CALCULATE(
    FILTER(
        'ECA Model',
        'ECA Model'[Month Name].[Month] >= PriviousMonth && 'ECA Model'[Month Name].[Month] <= CurrentMonth
    )
)
RETURN
Result
I have tryed adding ISEMPTY( 'ECA Model') but it wont let me add the measure to column if I add this 
 
My objective is to create a filter that helps select last 11 months data with the selected data
extrov
New Member

i have the same isuue with :

Corporate Sale for 2010 =
var
CorporateSale=FILTER(ALL(Orders[Customer Segment]),Orders[Customer Segment]="corporate")
var
CorporateDate=filter(ALL(DateOne[year]),DateOne[year]=2010)
var
CorporateSalesDate=FILTER(DateOne,DateOne[Date]=2010)
return
 CorporateSale & CorporateDate & CorporateSalesDate
NadaFathy193
Frequent Visitor

I have the same issue here ,plesae help me in order to solve this issue below the DAX that i used


FilteredProblemIDs =
VALUES(
   'PBI Relationship'[Problem ID]
   )
VAR FilteredTable =
FILTER(
   'PBI Relationship',
   'PBI Relationship'[RootCause1] IN {
       "Planner Activity-CRQ-planning",
       "Planner Activity-CRQ-Handling",
       "Planner Activity-CRQ-communication",
       "Planner Activity-CRQ-SecurityRecomediation"
   }
&& 'PBI Relationship'[Related ID] = "cause by"
&& NOT CONTAINSSTRING('PBI Relationship'[Request Description], "CRQ")
&& 'PBI Relationship'[Association Type] = "caused by"
)
RETURN
CALCULATETABLE(
   FilteredTable,
   'FilteredTable'
)
AlexisOlson
Super User
Super User

It's possible to have calculated tables inside a measure but if you want to return a table, then you need to use CALCULATETABLE rather than CALCULATE. However, since you are using _inadequate_security_ inside a SWITCH as if it is True/False, I suspect that you meant to have an argument in CALCULATE other than the filter table.

 

Did you intend to write something like this? (Note the line before FILTER.)

Inadequately secured loans =
VAR _inadequate_security =
    CALCULATE (
        ISEMPTY ( 'Table1' ),
        FILTER (
            'Table1',
            'Table1'[Collateral Amount] < 1.5 * 'Table1'[Loan Amount]
                && NOT ( 'Table1'[Product ID] IN { 2222, 8888 } )
        )
    )
VAR _result_ =
    SWITCH (
        TRUE (),
        _inadequate_security, "Inadeqaute Security",
        "Adequate Security"
    )
RETURN
    _result_

 

daXtreme
Solution Sage
Solution Sage

Hi there.

 

First and foremost, is this a measure? A calculated column?

 

The error you get stems from the fact that you cannot use CALCULATE to calculate tables in it, only scalar values, but FILTER does return a table, so it can't be used with CALCULATE as the first argument. The CALCULATE that you have wrapped FILTER in is totally unnecessary and, indeed, incorrect in this place. Also, please bear in mind you cannot return a table from a measure. Only scalar values are possible.

 

Incidentally, you have posted this question on a forum that deals with Power Query, not with DAX.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.