Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Groupby not working

Hello Community, 

 

I feel like I have the code correct for this, but I am getting the "expression refers to multiple columns..." error.  

 

What I am trying to do is to aggregate my orders (distinct) by the shipped price of all of the lines on the order.   So simply, the total value of each order but aggregated.   I need it for a very specific reason.  

 

Orders Shipped Price =
GROUPBY(
    ShippedOrdersALL_Query,
    ShippedOrdersALL_Query[Order Number],
    "Shipped Price", SUMX ( CURRENTGROUP (),ShippedOrdersALL_Query[ShippedPrice]))
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    If you create a calculated table, it should be able to output normally. It should be like:

    ShippedOrdersALL_Query_Order Number Shipped Price
    xxx xxx
    xxx xxx
    ... ...

    If you want a calculated column or measure, GROUPBY returns a table instead of a scalar, so this error is returned.

    CURRENTGROUP

     

    You can also consider putting [Order Number] and [ShippedPrice] into the table vision and setting up don't summarize.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    If you create a calculated table, it should be able to output normally. It should be like:

    ShippedOrdersALL_Query_Order Number Shipped Price
    xxx xxx
    xxx xxx
    ... ...

    If you want a calculated column or measure, GROUPBY returns a table instead of a scalar, so this error is returned.

    CURRENTGROUP

     

    You can also consider putting [Order Number] and [ShippedPrice] into the table vision and setting up don't summarize.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data