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
michaelsh
Kudo Kingpin
Kudo Kingpin

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
Kudo Kingpin
Kudo Kingpin

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
Kudo Kingpin
Kudo Kingpin

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])))

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
Super User

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

 

Other method for new column

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

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.