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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
prateekraina
Memorable Member
Memorable Member

Maximum from calculated Sum

Hi Guys,

 

Following is my dataset:

 

CameraTimeStampCount
Cam 110:001
Cam 110:001
Cam 110:001
Cam 210:001
Cam 210:001

 

I have written DAX to calculate the sum grouped by camera:

Total Count= SUM(Table[Count])

And i get following result in a table:

CameraTotal Count
Cam 13
Cam 22

 

Problem Statement:

The issue which i am facing is to get the camera which has highest count associated to it. In this case, it is Cam 1.

I have tried below DAX expression to get the Camera but it is not yielding the desired result. 

CALCULATE(VALUES(Table[Camera]),FILTER(Table,Table[Count] = MAX(Table[Count])))

Kindly help.

 

Prateek Raina

 

1 ACCEPTED SOLUTION
prateekraina
Memorable Member
Memorable Member

I have achived the desired result with below DAX:

Camera With Max People = 
VAR MaximumNoOfCountByCamera = MAXX(VALUES('Table'[Camera]),[Total Count])
VAR Table_SumOfCountGroupByCamera = SUMMARIZECOLUMNS(Table[Camera],"Count",SUM(Table[Count]))
RETURN
CALCULATE(VALUES(Table[Camera]),FILTER(Table_SumOfCountGroupByCamera,[CountofPeople] = MaximumNoOfCountByCamera))

 

If anybody finds any other alternative, let me know 🙂

 

Prateek Raina

 

View solution in original post

1 REPLY 1
prateekraina
Memorable Member
Memorable Member

I have achived the desired result with below DAX:

Camera With Max People = 
VAR MaximumNoOfCountByCamera = MAXX(VALUES('Table'[Camera]),[Total Count])
VAR Table_SumOfCountGroupByCamera = SUMMARIZECOLUMNS(Table[Camera],"Count",SUM(Table[Count]))
RETURN
CALCULATE(VALUES(Table[Camera]),FILTER(Table_SumOfCountGroupByCamera,[CountofPeople] = MaximumNoOfCountByCamera))

 

If anybody finds any other alternative, let me know 🙂

 

Prateek Raina

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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