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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
aashton
Helper V
Helper V

Grouping by a field and finding the max

Hello,

So I have the following table structure:  

aashton_0-1655136567408.png

And use this DAX formula to find the total amount of Deals by Owner by Phase (one for each phase):

Phase 1 2022 Approvals Count by Owner =
CALCULATE(
DISTINCTCOUNT('Deal Review'[Deals Reviewed (Since 2019)]),
FILTER(
ALLEXCEPT('Deal Review','Deal Review'[Owner]),
SEARCH("2022", 'Deal Review'[Phase 1], , BLANK() ) > 0
))
 
I would now like to display on cards, the owners name that has the most Phase 1, Phase 2 and Phase 3's.  Not sure how to accomplish this?
 
Thank you.
1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @aashton 

Thanks for reaching out to us.

Let's take phase 1 as an example, create the measures
-

Phase 1 2022 Approvals Count by Owner =
CALCULATE (
    DISTINCTCOUNT ( 'Deal Review'[Deals Reviewed (Since 2019)] ),
    FILTER (
        ALL ( 'Deal Review' ),
        'Deal Review'[Owner] = MIN ( 'Deal Review'[Owner] )
            && SEARCH ( "2022", 'Deal Review'[Phase 1],, BLANK () ) <> BLANK ()
    )
)

-

max owner =
VAR _max =
    MAXX ( 'Deal Review', [Phase 1 2022 Approvals Count by Owner] )
RETURN
    CALCULATE (
        MAX ( 'Deal Review'[Owner] ),
        FILTER ( 'Deal Review', [Phase 1 2022 Approvals Count by Owner] = _max )
    )

result 

vxiaotang_0-1655347576428.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @aashton 

Thanks for reaching out to us.

Let's take phase 1 as an example, create the measures
-

Phase 1 2022 Approvals Count by Owner =
CALCULATE (
    DISTINCTCOUNT ( 'Deal Review'[Deals Reviewed (Since 2019)] ),
    FILTER (
        ALL ( 'Deal Review' ),
        'Deal Review'[Owner] = MIN ( 'Deal Review'[Owner] )
            && SEARCH ( "2022", 'Deal Review'[Phase 1],, BLANK () ) <> BLANK ()
    )
)

-

max owner =
VAR _max =
    MAXX ( 'Deal Review', [Phase 1 2022 Approvals Count by Owner] )
RETURN
    CALCULATE (
        MAX ( 'Deal Review'[Owner] ),
        FILTER ( 'Deal Review', [Phase 1 2022 Approvals Count by Owner] = _max )
    )

result 

vxiaotang_0-1655347576428.png

 

Best Regards,

Community Support Team _Tang

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

Yes, that worked!!! Thank you so much

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.