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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Drobb
Frequent Visitor

Max value filtered and grouped

Hi, 

I have a moderately specific question that I have been struggling with for some time.  

I have a table called "performance" that has the columns: ID; Sitename; Date; NumberofTransactions.  The 'performance'[Date] column is connected with a many to one relationship to a general 'calendar'[Date] table being used to filter the data. 

 

I am trying to return the max NumberofTransactions 1 ID has had for each Sitename, filterable by the date. 

 

So for example, if I had the data set below where ID-Sitename-Date-NumberofTransactions: 

AB-Ancorage-1/1/23-16

AB-Ancorage-1/2/23-18

AB-Ancorage-1/3/23-19

AC-Ancorage-1/2/23-2

AC-Ancorage-1/3/23-29

DA-Dallas-1/2/23-19

DA-Dallas-1/5/23-20

DB-Dallas-1/2/23-17

 

The Resulting Table would look like this: ID-Site-NumberofTransactions-MaxNumberofTransactionsofSite  when filtered on the dates 1/2/23-1/3/23: 

AB-Ancorage-37-37

AC-Ancorage-31-37

DA-Dallas-19-19

DB-Dallas-17-19

 

The hardest link for me has been to get it to be filterable by date.   Any support is appreciated.

 

2 ACCEPTED SOLUTIONS
Dangar332
Super User
Super User

hi, @Drobb 

try below measure

 

max no of side = 
var a =ADDCOLUMNS(ALL(performance[id],performance[sitename]),"sum",CALCULATE(SUM(performance[no of tran]),performance[sitename]=MAX(performance[sitename])))
return
MAXX(FILTER(a,performance[sitename]=MAX(performance[sitename])),[sum])

 

Dangar332_0-1704380350908.png

 

View solution in original post

Anonymous
Not applicable

Hi @Drobb ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

var _table =ADDCOLUMNS(SUMMARIZE(ALL('performance'),[ID],[Sitename]),"sum",CALCULATE(SUM(performance[NumberofTransactions]),performance[sitename]=MAX(performance[sitename])))
return
MAXX(FILTER(_table,[sitename] in VALUES('performance'[Sitename])),[sum])

(3) Then the result is as follows.

vtangjiemsft_0-1704874097330.png

Best Regards,

Neeko Tang

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Drobb ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a measure. 

var _table =ADDCOLUMNS(SUMMARIZE(ALL('performance'),[ID],[Sitename]),"sum",CALCULATE(SUM(performance[NumberofTransactions]),performance[sitename]=MAX(performance[sitename])))
return
MAXX(FILTER(_table,[sitename] in VALUES('performance'[Sitename])),[sum])

(3) Then the result is as follows.

vtangjiemsft_0-1704874097330.png

Best Regards,

Neeko Tang

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

Dangar332
Super User
Super User

hi, @Drobb 

try below measure

 

max no of side = 
var a =ADDCOLUMNS(ALL(performance[id],performance[sitename]),"sum",CALCULATE(SUM(performance[no of tran]),performance[sitename]=MAX(performance[sitename])))
return
MAXX(FILTER(a,performance[sitename]=MAX(performance[sitename])),[sum])

 

Dangar332_0-1704380350908.png

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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