Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ivamsikrishna
Frequent Visitor

Hierarchy sorting

Team, we are trying to develop typical FI report which required detailed level of custom sorting order to match client needs. Below is the sample data. 

SegmentMainSubOrder NumberDescSegment1 
Segment1FirstStrawberry30000FSSBerry$5,330.00
Segment1FirstBlueberry30100FSBBerry$2,541.00
Segment1FirstBlackberry30200FSBLBerry$1,254.00
Segment1FirstRaspberry30300FLRBerry$8,745.00
Segment1FirstPineberies30400FSPBerry$2,365.00
Segment1FirstVeggie30500FSVeggie$1,458.00
Segment1FirstOther30800FSCherry$4,752.00
Segment1FirstOther30900FSDoc$252,155.00
Segment1FirstOther31200FSSNKS$22,112.00
Segment1FirstOther32000FSCRDT$25,633.00
Segment1FirstStrawberry33000RSSBERRY$255,256.00
Segment1FirstBlueberry33100RTBBerry$98,574.00
Segment1FirstBlackberry33200RTBLBerry$45,215.00
Segment1FirstRaspberry33300RTRBerry$239,874.00
Segment1FirstPineberies33400RTPBerry$4,655.00
Segment1FirstVeggie33500RTVeggie$288,745.00
Segment1FirstStrawberry34000FTSBerry$56,621.00
Segment1FirstStrawberry34050FTASBerry$68,745.00
Segment1FirstBlueberry34100FTOBLBerry$51,235.00
Segment1FirstBlueberry34150FTABLUBerry$485,145.00
Segment1FirstBlackberry34200FTBLBerry$148,752.00
Segment1FirstBlackberry34250FTABLBerry$2,365,987.00
Segment1FirstRaspberry34300FTRSBerry$545,635.00
Segment1FirstRaspberry34350FTARABerry$1,254,123.00
Segment1FirstVeggie34500FTOVeggie$1,587.00
Segment1FirstVeggie34550FTAVeggie$4,562.00
Segment1FirstOther34800FTADJ$5,874.00
Segment2FirstStrawberry30000FSSBerry$4,280.00
Segment3FirstBlueberry30100FSBBerry$1,491.00
Segment4FirstBlackberry30200FSBLBerry$204.00
Segment5FirstRaspberry30300FLRBerry$7,695.00
Segment6FirstPineberies30400FSPBerry$1,315.00
Segment7FirstVeggie30500FSVeggie$408.00
Segment8FirstOther30800FSCherry$3,702.00
Segment9FirstOther30900FSDoc$251,105.00
Segment10FirstOther31200FSSNKS$21,062.00
Segment11FirstOther32000FSCRDT$24,583.00
Segment12FirstStrawberry33000RSSBERRY$254,206.00
Segment13FirstBlueberry33100RTBBerry$97,524.00
Segment14FirstBlackberry33200RTBLBerry$44,165.00
Segment15FirstRaspberry33300RTRBerry$238,824.00
Segment16FirstPineberies33400RTPBerry$3,605.00
Segment17FirstVeggie33500RTVeggie$287,695.00
Segment18FirstStrawberry34000FTSBerry$55,571.00
Segment19FirstStrawberry34050FTASBerry$67,695.00
Segment20FirstBlueberry34100FTOBLBerry$50,185.00
Segment21FirstBlueberry34150FTABLUBerry$484,095.00
Segment22FirstBlackberry34200FTBLBerry$147,702.00
Segment23FirstBlackberry34250FTABLBerry$2,364,937.00
Segment24FirstRaspberry34300FTRSBerry$544,585.00
Segment25FirstRaspberry34350FTARABerry$1,253,073.00
Segment26FirstVeggie34500FTOVeggie$537.00
Segment27FirstVeggie34550FTAVeggie$3,512.00
Segment28FirstOther34800FTADJ$4,824.00

 

we try and expecting in below order in Matrix visualization, we try applying different sorting options but not successful because of multiple sub sections are with same name but client would like to see data sorting on order number. They don't want to group things by Sub section. 

 

MainSubOrder NumberDescSegment1 Segment2
FirstStrawberry30000FSSBerry$5,330.00$4,280.00
FirstBlueberry30100FSBBerry$2,541.00$1,491.00
FirstBlackberry30200FSBLBerry$1,254.00$204.00
FirstRaspberry30300FLRBerry$8,745.00$7,695.00
FirstPineberies30400FSPBerry$2,365.00$1,315.00
FirstVeggie30500FSVeggie$1,458.00$408.00
FirstOther30800FSCherry$4,752.00$3,702.00
FirstOther30900FSDoc$252,155.00$251,105.00
FirstOther31200FSSNKS$22,112.00$21,062.00
FirstOther32000FSCRDT$25,633.00$24,583.00
FirstStrawberry33000RSSBERRY$255,256.00$254,206.00
FirstBlueberry33100RTBBerry$98,574.00$97,524.00
FirstBlackberry33200RTBLBerry$45,215.00$44,165.00
FirstRaspberry33300RTRBerry$239,874.00$238,824.00
FirstPineberies33400RTPBerry$4,655.00$3,605.00
FirstVeggie33500RTVeggie$288,745.00$287,695.00
FirstStrawberry34000FTSBerry$56,621.00$55,571.00
FirstStrawberry34050FTASBerry$68,745.00$67,695.00
FirstBlueberry34100FTOBLBerry$51,235.00$50,185.00
FirstBlueberry34150FTABLUBerry$485,145.00$484,095.00
FirstBlackberry34200FTBLBerry$148,752.00$147,702.00
FirstBlackberry34250FTABLBerry$2,365,987.00$2,364,937.00
FirstRaspberry34300FTRSBerry$545,635.00$544,585.00
FirstRaspberry34350FTARABerry$1,254,123.00$1,253,073.00
FirstVeggie34500FTOVeggie$1,587.00$537.00
FirstVeggie34550FTAVeggie$4,562.00$3,512.00
FirstOther34800FTADJ$5,874.00$4,824.00
1 ACCEPTED SOLUTION

Maybe I'm a little lost. From what I understand, the client doesn't care how any of the other fields are sorted, they only want to see the visual sorted by order number in ascending order? Can you confirm and also show a screenshot of your matrix visual and the fields included?

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @ivamsikrishna ,

 

Please try code as below to create measures.

Segment 1 =
CALCULATE (
    SUM ( 'Table'[Segment1] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Sub], 'Table'[Desc] ),
        'Table'[Segment] = MIN ( 'Table'[Segment] )
    )
)
Segment 2 =
CALCULATE (
    SUM ( 'Table'[Segment1] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Sub], 'Table'[Desc] ),
        'Table'[Segment] = MAX ( 'Table'[Segment] )
    )
)

Result is as below.

vrzhoumsft_0-1696226334782.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CoreyP
Solution Sage
Solution Sage

I feel like you should be able to just sort the visual by the order number column in descending order. If for some reason that doesn't work, you can always create calculated columns in your tables to use as sort by columns.

We tried that but because of the Sub column (where the subjects are repeated and we cannot apply different sorting order on same field), any other work around could be helpful. Appreciate.

Maybe I'm a little lost. From what I understand, the client doesn't care how any of the other fields are sorted, they only want to see the visual sorted by order number in ascending order? Can you confirm and also show a screenshot of your matrix visual and the fields included?

Thanks for the reply, can use also use this in Matrix correct because we need to add totals and sub-totals. Appreciate for your help.

the second table in my post is the matrix I am trying to achieve and first table is the data feed. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.