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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
yuanye0710
Frequent Visitor

Max of columns in Matrix

Hello, I'd like to plot a Matrix with date as columns, and another column at the end to calculate the max of thses dates for each category. User can use a slicer to select different dates, so the Max measure has to be dynamic too. 

 

For example: 

Data:

Category   Year/Month   Value
A202201100
A20220280
A20220397
B202201115
B202203118
B20220498
C202202106
C20220399
C20220479
C20220661
C20220862
D20220190
D202202115
D202207116
D202208115
E202202117
E202205112
F20220192

 

 

The final matrix will look like this, where Max equals to the Maximum of each date column for a given category. There will be a date slicer for user to choose different dates. The matrix will update according to user's date selection.

 202201   202202   202203   202204   202205   202206   202207   202208   Max
A         
B         
C         
D         
E         
F         

The problem is if I put the Year/Month in "Columns" field of the matrix, then my Max measure will be added to all date as well (instead of at the end). I also don't want to write a separate measure for each date because it will be a lot maintenance work.

 

Thanks.

4 REPLIES 4
Manoj_Nair
Solution Supplier
Solution Supplier

@yuanye0710 pls try a simple DAX, straightforward solution or or even you can drag and drop the value in the metric column with max value- it works or you are after something else.

 

MAX = MAX(’max’[value])

Desired output = 

image.jpg

 Backend Data

image.jpg

Thanks but it's not what I was looking for. I plot this in Excel, each yellow cell is the sum of value for a given (category, year/month) pair, and then an additional Max column at the end to calculate the maximum of that row.

 

yuanye0710_1-1670591216757.png

 

 

@yuanye0710 - try first summarising the table and then use the normal metrics. Screen grab explaining the back end steps.

image.jpg

The summarize table is made out of your sample datasets as shown below.

image.jpg

FreemanZ
Super User
Super User

try like

MaxInCategory =

VAR _MaxAll = 

CALCULATE(

    MAX(TableName[Value]),

    ALL(TableName[Year/Month])

)

VAR _Max = MAX(TableName[Value])

RETURN

IF(_MaxAll = _Max, _MaxAll)

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.