Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Multiple columns cannot be converted to a scalar value|tried both measure and calculated column

I am trying to retrieve specific KPI status % on donut(Pass,fail,pending) using month slicer on visual but getting the error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."

 

I tried it with both measure and calculated column. Although i doubt on using calculated column becoz im not doing any calculations in table columns , it is retrieval of text status . 

 

any help will be appriciated 

 

KPI Status Name =
VAR ThisMonthKPIStatusName =
SWITCH (
SELECTEDVALUE ( 'Date Table'[MonthName]),
"July", FILTER('07142020','07142020'[KPI Status]),
"August", FILTER('08042020','08042020'[KPI Status])
)
RETURN
ThisMonthKPIStatusName

7 Replies

  • Anonymous , When you created a column or measure you expected to return a column of measure

    This is returning Table. Filter return Table

    FILTER('07142020','07142020'[KPI Status])

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi amitchandak 

       

      thanks for quick response, FILTER('07142020','07142020'[KPI Status]) , here KPI [status] is column of table 07142020

       

      can you suggest what should i ammend to get expected outcome. 

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Anonymous , then it should be like

        KPI Status Name =
        VAR ThisMonthKPIStatusName =
        SWITCH (
        SELECTEDVALUE ( 'Date Table'[MonthName]),
        "July", '07142020'[KPI Status],
        "August", '08042020'[KPI Status]
        )

        Not this can not be column because you use selected value so return measure

         

        KPI Status Name =
        VAR ThisMonthKPIStatusName =
        SWITCH (
        SELECTEDVALUE ( 'Date Table'[MonthName]),
        "July", Max('07142020'[KPI Status]),
        "August", max('08042020'[KPI Status])
        )

        return ThisMonthKPIStatusName