cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
michaelsh
Helper V
Helper V

Maximum Monthly Revenue per Customer - DAX

I've created a calculated column that calculates the maximum Monthly revenue per customer.

I achieve the desired result, but maybe thaere is a more elegant/effective way to do this?

 
Highest Month Rev per Customer =
VAR c = Usage[Customer]
VAR m = VALUES(Usage[Month])
RETURN
MAXX(ADDCOLUMNS(m,"Monthly Revenue",CALCULATE(SUM(Usage[Revenue]),FILTER(ALLEXCEPT(Usage,Usage[Month],Usage[Customer]),Usage[Customer]=c))),[Monthly Revenue])
 
 
Screenshot 2021-04-07 181401.png
1 ACCEPTED SOLUTION
michaelsh
Helper V
Helper V

This also works, but I I am thinking whether it can possibly create circular reference issue...

MAXX(VALUES(Usage[Month]),CALCULATE(SUM(Usage[Revenue]),ALLEXCEPT(Usage,Usage[Customer],Usage[Month])))

View solution in original post

3 REPLIES 3
michaelsh
Helper V
Helper V

This also works, but I I am thinking whether it can possibly create circular reference issue...

MAXX(VALUES(Usage[Month]),CALCULATE(SUM(Usage[Revenue]),ALLEXCEPT(Usage,Usage[Customer],Usage[Month])))

View solution in original post

Hi, @michaelsh 

Have amitchandak’s suggestion helped you to find the solution to this problem?

If his reply has helped you to solve this problem, would you like to mark your own reply as a solution so that others can learn from it too?

 

According to my test, this kind of measure won’t cause a circular reference issue:

v-robertq-msft_0-1617955323830.png

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

amitchandak
Super User IV
Super User IV

@michaelsh , approch is fine, if it is working.

 

Other method for new column

maxx(filter(Usage, [Customer] =earlier([Customer]) && [Month] =earlier([Month])), [Revenue])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors