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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Wilbike
Regular Visitor

Return Max Number result by Project, and combine max figures when Payment Type is the same

Hi Everyone,

 

I am trying to create a measure that is able to return the max Payment Value for a Project (1,2 or 3), and when the payment type is the same for the project, I'd like this combined value to be included when determining the maximum payment value for a project.

 

For example:

Project 2 has two Y payment types which have a combined value 110. I'd like this value to be produced from the MAX measure as the maximum Payment Value for this Project

 

Wilbike_0-1668509668116.png

 

The previous measure I have tried is:

=SUMX(VALUES(PaymentTable[Project]),CALCULATE(MAX(PaymentTable[Payment Value])))

But this will only return the single maximum figure for payment value, and not the combined value if the Payment Type is the same for a given project.

If this can be done without a measure then I'd be interested in hearing this to! 

Thanks in advance!

1 ACCEPTED SOLUTION

Here's the same measure as @johnt75's but without the unnecessary fluff:

Max Value =
MAXX(
    DISTINCT( 'Table'[Payment type] )
    CALCULATE( SUM( 'Table'[Value] ) )
)

and might be faster as it does not materialize results as the measure above does because of ADDCOLUMNS.

View solution in original post

3 REPLIES 3
Wilbike
Regular Visitor

Thanks for posting @johnt75 .

@daXtreme that solution worked! Thank you very much!

johnt75
Super User
Super User

You could create a measure like 

Max Value =
VAR SummaryTable =
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', 'Table'[Payment type] ),
        "@val", CALCULATE ( SUM ( 'Table'[Value] ) )
    )
RETURN
    MAXX ( SummaryTable, [@val] )

Here's the same measure as @johnt75's but without the unnecessary fluff:

Max Value =
MAXX(
    DISTINCT( 'Table'[Payment type] )
    CALCULATE( SUM( 'Table'[Value] ) )
)

and might be faster as it does not materialize results as the measure above does because of ADDCOLUMNS.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors