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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
rhcma
Regular Visitor

Measure to return the max value per category's text column in matrix

Hello,

 

I have not had any luck with this so far. Basically I would like to show in a matrix column the text value for the largest Request ID per Record ID when the matrix is collasped. (Request ID is the primary key)

 

Sample data below, highlighted is the two highest Request IDs per Record ID and their First text per Record Id.

rhcma_0-1753283577292.png

When I collaspe the the matrix the First text quick measure displays the first value A to Z (or last value if you use the Last quick measure). I would like the text to instead display the above highlighted largest request ID's text.

 

rhcma_1-1753284108231.png

I hope that's clear, let me know any questions.

 

Record IDRequest IDText
100001200013An agreement description
100001200072Description of agreeement
100001200007Varied Description
100001200023Description again for agreement
100002200083New Agreement Description Agreement
100002200091Second description agreement
100003200015Varied Description Agreement
100004200071Post it note
100005200047Water bottle
100005200082Mouse
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @rhcma ,

 

Try the following measure:

Text Value = 
            VAR temptable = TOPN(1, SELECTCOLUMNS('Table', "ID",'Table'[Record ID],"Request",'Table'[Request ID],"Text",'Table'[Text]), [Request], DESC)
            Return
                MAXX(temptable, [Text])

MFelix_0-1753285085210.pngMFelix_1-1753285103513.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

3 REPLIES 3
speedramps
Super User
Super User

Try this  ....

Answer = 
// get the max request ID for the line beinf displayed
VAR max_requestid = MAX(yourdata[Request ID])

// get the text for the max request ID 
VAR max_requestid_text =
CALCULATE(
    MAX(yourdata[Text]),
    yourdata[Request ID] = max_requestid
)
RETURN
// when the matrix is expanded display the row text value
// when the matic is collapse display the text for the max request ID 

IF(ISFILTERED(yourdata[Request ID]),
MAX(yourdata[Text]),
max_requestid_text)

 

speedramps_0-1753286011883.png

Please click thumbs up because I have tried to help.

Then click [accept solution] if it works.

 

MFelix
Super User
Super User

Hi @rhcma ,

 

Try the following measure:

Text Value = 
            VAR temptable = TOPN(1, SELECTCOLUMNS('Table', "ID",'Table'[Record ID],"Request",'Table'[Request ID],"Text",'Table'[Text]), [Request], DESC)
            Return
                MAXX(temptable, [Text])

MFelix_0-1753285085210.pngMFelix_1-1753285103513.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Thank you very much! That works in test I will post a follow up if I run into any issues!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.