Forum Discussion

KoroneL's avatar
KoroneL
Frequent Visitor
1 year ago
Solved

Sort by column not possible

I have a table that I want to use to create a report. My goal is to aggregate data by the column DescLvlGroup, which is almost identical to DescCodLvl. The difference is that for aggregation, "Cash" should include (Cash + Out of Order + Other Debts + Commissions).

Row LabelsSum of value
Assets6500
Cash4650
Investiments500
Merch 13000
Merch 21000
Grand Total15650

I successfully created a measure to handle this aggregation, and it works fine. However, when I try to sort DescLvlGroup by _OrderCodLvl, Power BI gives an error because some values in _OrderCodLvl are not unique for each DescLvlGroup.

Is there any way to fix this issue? I can’t figure out how to sort it properly. Any help would be appreciated!

Here's a simplified table i used:

DescCodLvlDescCodLvlvalue_OrderCodLvlDescLvlGroup
Company 254Cash500025009999Cash
Company 263Assets650025003000Assets
Company 272.2Merch 1300025002200Merch 1
Company 282.1Merch 2100025002100Merch 2
Company 291Investiments50025001000Investiments
Company 309Out of Order025009999Cash
Company 316Other Debts-10025009999Cash
Company 325Comissions-25025009999Cash

 

Thanks in advance!

  • KoroneL Create a new calculated column in your table that concatenates DescLvlGroup and _OrderCodLvl to form a unique value for sorting.

     

    UniqueSortKey = CONCATENATE(DescLvlGroup, _OrderCodLvl)

     

    Use this new UniqueSortKey column to sort your DescLvlGroup column.

2 Replies

  • KoroneL Create a new calculated column in your table that concatenates DescLvlGroup and _OrderCodLvl to form a unique value for sorting.

     

    UniqueSortKey = CONCATENATE(DescLvlGroup, _OrderCodLvl)

     

    Use this new UniqueSortKey column to sort your DescLvlGroup column.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the reply from bhanu_gautam.

     

    Hi KoroneL ,

     

    It can be sorted during my test. 

    Have you solved your problem? If it is solved, please mark the reply that help you as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster. If there are any more questions, please feel free to let us know. Thanks a lot!

     

    Best Regards,
    Zhu