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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Giel0
Frequent Visitor

Sort dimension which used as value in Matrix table

Hi all,

 

I have a matrix table with Orders and orderlines as rows. Furthermore, the productcode and description are dimensions which are placed as 'value' (first value) in the matrix table. When expanded, everything is correct because there is only 1 product for each orderline. 

Giel0_1-1693396301804.png

What I would like to do is that if the matrix table is collapsed, the productcode and description of the first orderline (10) should be showed. 

Coincidentally is this already correct for the productcode because the first orderline contains the productcode with the lowest number. However, the description is sorted alphabetically, so now the wrong description is shown which does not belong to that productcode. 

 

Giel0_2-1693396447637.png

 

I already tried to sort the decription column on Productcode, but this doesnt seem to work. 

Are there any other ways to achieve this?

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @Giel0 

According to your description, you want to "if the matrix table is collapsed, the productcode and description of the first orderline (10) should be showed. ".

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1693534425875.png

 

(2)We can create two measures like this:

Description Measure = var _t =SUMMARIZE('Table','Table'[Orderline],'Table'[description]) 
var _min_line = MINX(_t,[Orderline])
return
MAXX(FILTER(_t , [Orderline] = _min_line) , [description])
Productcode Measure = var _t =SUMMARIZE('Table','Table'[Orderline],'Table'[productcode]) 
var _min_line = MINX(_t,[Orderline])
return
MAXX(FILTER(_t , [Orderline] = _min_line) , [productcode])

 

(3)Then we cna put this measures on the visual and we can get the result as follows:

vyueyunzhmsft_1-1693534657997.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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
v-yueyunzh-msft
Community Support
Community Support

Hi , @Giel0 

According to your description, you want to "if the matrix table is collapsed, the productcode and description of the first orderline (10) should be showed. ".

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1693534425875.png

 

(2)We can create two measures like this:

Description Measure = var _t =SUMMARIZE('Table','Table'[Orderline],'Table'[description]) 
var _min_line = MINX(_t,[Orderline])
return
MAXX(FILTER(_t , [Orderline] = _min_line) , [description])
Productcode Measure = var _t =SUMMARIZE('Table','Table'[Orderline],'Table'[productcode]) 
var _min_line = MINX(_t,[Orderline])
return
MAXX(FILTER(_t , [Orderline] = _min_line) , [productcode])

 

(3)Then we cna put this measures on the visual and we can get the result as follows:

vyueyunzhmsft_1-1693534657997.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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