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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
PBI_SUPERUSER
Frequent Visitor

Sorting a matrix with a field hidden inside the measure

Hi,

I have created a matrix with a as below.

 

PBI_SUPERUSER_0-1712553906078.png

 

PBI_SUPERUSER_1-1712554159537.png

 

 

Answer is a mesure which is consists of several other measures.

Answer =
var metric =
SWITCH( SELECTEDVALUE(Driver[ID]),
1, Table[Y-6],
2,Table[Y-5],
3,Table[Y-4],
4,Table[Y-3],
5,Table[Y-2],
6,Table[Y-1],
7,Table[FY24],
8,Table[FY25],
9,Table[Highest Ever Sales in Last 5 Years],
10,Table[AverageSales_in_Last 5 Years],
11,Table[AverageSales_in_Last 12 Months],
12,Table[AverageSales_in_Last 3 Months],
13,Table[FY25MTD])
RETURN
metric
 
I need to sort the matrix by [FY24] from highest to lowest.But sort option in matrix visulization only show [answer] .is there a way to do this.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @PBI_SUPERUSER ,

 

Try to modify your formula like below:

answer =
VAR metric =
    SWITCH (
        SELECTEDVALUE ( 'Table'[DriverID] ),
        1, [Table_Y1],
        2, [Table_Y2],
        3, [Table_Y3]
    )
RETURN
    IF (
        ISFILTERED ( 'Table (2)'[Y-1] ),
        CALCULATE (
            metric,
            FILTER ( ALLSELECTED ( 'Table (2)' ), NOT ISBLANK ( [Y-1] ) ),
            ALLSELECTED ( 'Table (2)' )
        ),
        metric
    )

vkongfanfmsft_0-1712630815356.png

Best Regards,
Adamk Kong

 

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @PBI_SUPERUSER ,

 

Try to modify your formula like below:

answer =
VAR metric =
    SWITCH (
        SELECTEDVALUE ( 'Table'[DriverID] ),
        1, [Table_Y1],
        2, [Table_Y2],
        3, [Table_Y3]
    )
RETURN
    IF (
        ISFILTERED ( 'Table (2)'[Y-1] ),
        CALCULATE (
            metric,
            FILTER ( ALLSELECTED ( 'Table (2)' ), NOT ISBLANK ( [Y-1] ) ),
            ALLSELECTED ( 'Table (2)' )
        ),
        metric
    )

vkongfanfmsft_0-1712630815356.png

Best Regards,
Adamk Kong

 

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.