cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Sorting a matrix with a field hidden inside the measure

Hi,

I have created a matrix with a as below.

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

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
Community Support

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
)
``````

Best Regards,

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

Community Support

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
)
``````

Best Regards,

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors