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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Group by Dax functions

Hi,

 

I have data that looks like this: 

 

Brown colored are input columns

Blue colored are output column

 

Anchor Config IDTarget Config ID

Dealer

(of target config ID)

Enabled for requested dealer# of dealers target config mapped to 
101101D140Yes1 
101102H200Yes2 
101102D140Yes2 
101103Z050No1 
102101N050Yes1 
102102N050Yes1 
102103D140No1 
103101E070No1 
103102E300No1 
103103N150Yes1 

 

Logic

1 Enabled for requested dealer:

 

In the above example, Anchor Config is a filter.

If (Dealer of Anchor Config = Dealer of Target Config) then Yes else No

 

Eg dealer of 102 is D140 and so is the dealer of 101 so Enabled for requested dealer for 102=Yes

 

 

Caveat: If target config ID has  > 2 dealers with atleast 1 Yes, then all those rows for target config id will become Yes

 

 

 

# of dealers target config mapped to

If target config ID occurs more than once then count (rows)

 

Eg there are 2 dealers for 102 Target Config or 2 rows of repeated values, so all 102 Target Config IDs values will become 2 for # of dealers target config mapped to

 

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

Enabled for requested dealer = 
VAR CurrentAnchor = 'Table'[Anchor Config ID]
VAR CurrentAnchorDealer =
    CALCULATE ( MAX ( 'Table'[Dealer] ), CurrentAnchor = 'Table'[Target Config ID] )
VAR CountOfTargetDealer =
    CALCULATE (
        COUNT ( 'Table'[Target Config ID] ),
        ALLEXCEPT ( 'Table', 'Table'[Anchor Config ID], 'Table'[Target Config ID] )
    )
RETURN
    IF (
        CurrentAnchorDealer <> BLANK (),
        "Yes",
        IF ( CountOfTargetDealer >= 2 && CurrentAnchorDealer = BLANK (), 
        "Yes", 
        "No" )
    )
# of dealers target config mapped to =
CALCULATE (
    COUNT ( 'Table'[Target Config ID] ),
    ALLEXCEPT ( 'Table', 'Table'[Anchor Config ID], 'Table'[Target Config ID] )
)

group by dax.PNG

 

Best Regards,

Icey

 

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

 

View solution in original post

1 REPLY 1
Icey
Community Support
Community Support

Hi @Anonymous ,

Try this:

Enabled for requested dealer = 
VAR CurrentAnchor = 'Table'[Anchor Config ID]
VAR CurrentAnchorDealer =
    CALCULATE ( MAX ( 'Table'[Dealer] ), CurrentAnchor = 'Table'[Target Config ID] )
VAR CountOfTargetDealer =
    CALCULATE (
        COUNT ( 'Table'[Target Config ID] ),
        ALLEXCEPT ( 'Table', 'Table'[Anchor Config ID], 'Table'[Target Config ID] )
    )
RETURN
    IF (
        CurrentAnchorDealer <> BLANK (),
        "Yes",
        IF ( CountOfTargetDealer >= 2 && CurrentAnchorDealer = BLANK (), 
        "Yes", 
        "No" )
    )
# of dealers target config mapped to =
CALCULATE (
    COUNT ( 'Table'[Target Config ID] ),
    ALLEXCEPT ( 'Table', 'Table'[Anchor Config ID], 'Table'[Target Config ID] )
)

group by dax.PNG

 

Best Regards,

Icey

 

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

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors