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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors