Forum Discussion

Stuznet's avatar
Stuznet
Icon for Helper V rankHelper V
7 years ago
Solved

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

Hi all,

 

I googled it couldn't find the answer. Here is my dax function. Can you guys assist? 

 

So here is the logic. Count rows that match "25%" string from a Percent column

 

Test = SWITCH(TRUE(),
    
MAX(data[Month]) = "April",
    COUNT(Data[Percent]),FILTER(data,[Percent] = "25%"))

Thanks

 

 

  • Hi, Stuznet

     

    Try this one, please.

     

    Test =
    SWITCH (
        TRUE (),
        MAX ( data[Month] ) = "April", CALCULATE ( COUNT ( 'Data'[Percent] ), FILTER ( 'data', [Percent] = "25%" ) )
    )
    

     

    Best Regards,
    Dale

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi, Stuznet

     

    Try this one, please.

     

    Test =
    SWITCH (
        TRUE (),
        MAX ( data[Month] ) = "April", CALCULATE ( COUNT ( 'Data'[Percent] ), FILTER ( 'data', [Percent] = "25%" ) )
    )
    

     

    Best Regards,
    Dale