Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dax issue

Company ,    Product name
Tatamotors,        Tiago
Tatamotors ,       Alto
Tatamotors  ,     Nexo
Maruti ,              Ciaz
Maruti  ,            vagnour
Hundai  ,            I20
Hundai   ,          Creta

In above senario, Ihave to count total number of products by each company:

Below dax I have written but getting error as "The expression refrers to multiple column.Multiple columns can not be converted to a scalar value: Please suggest:

Groupby(Automobile,automobile[company],"Total number of Product", Countax(currentgroup(),automobile[product name]))

  • Hi Ashokkumarsah, 

     

    GROUPBY() function return a table with the selected columns for the groupBy_columnName arguments and the grouped by columns designated by the name arguments. So you should create a new table, not a calculate column or measure.

     

    Regards,

    Jimmy Tao

2 Replies

  • PattemManohar's avatar
    PattemManohar
    Community Champion

    Anonymous Not sure why itsn't working ? Hope you are trying it as a "New Table"

     

    Test130Out = GROUPBY(Test130GroupCnt,Test130GroupCnt[Company],"ProductCount",COUNTAX(CURRENTGROUP(),Test130GroupCnt[ProductName]))

  • v-yuta-msft's avatar
    v-yuta-msft
    Community Support

    Hi Ashokkumarsah, 

     

    GROUPBY() function return a table with the selected columns for the groupBy_columnName arguments and the grouped by columns designated by the name arguments. So you should create a new table, not a calculate column or measure.

     

    Regards,

    Jimmy Tao