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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
TRPBI
New Member

DAX Query

Hello,
I need your help please.
i have a column i created with the dax, the values for example A, AB, ABC, BC, C, B, AC, i need to create a filter that shows me A, B, C
A : when the values are A, AB, ABC, AC
B : when the values are AB, ABC, BC, B
C : when the values are ABC, BC, C, AC
I created a DAX query
Team = IF (NameColumn IN {"A", "AB", "ABC", "AC"}, "A"
, IF (NameColumn IN {"AB", "ABC", "BC", "B"}, "B"
, if (NameColumn IN {"ABC", "BC", "C", "AC"}, "C", "Other")))
This DAX query did not work, it shows me these results :

For exemple :

DAX Results how i need.PNG

when I click on A in the filter it shows me the sum of AB, A, ABC : 2+3+5

when I click on B in the filter it shows me the sum of  : BC,B : 4+2

when I click on B in the filter it shows me the sum of  : BC,B : 4+2

it does not show me the value C in the filter.

 

 

but what I'm looking for is to make a filter with the values A, B and C

Exemple:

DAX Results how i need.PNG

when I click on A in the filter it shows me the sum of AB, A, ABC : 2+3+5

where i click on B in the filter it shows me the sum of AB,ABC,BC,B : 2+5+4+2

where i click on C in the filter it shows me the sum of ABC,BC : 5+4 

is it possible to do that ?

Thanks for your help

 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @TRPBI ,

According to your description, here’s my solution.

1.Create a table, there’s no relationship between the two tables.

vkalyjmsft_0-1636940278648.png

 

2.Create a measure.

Result =

SWITCH (

    SELECTEDVALUE ( 'Table (2)'[Type] ),

    "A",

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', [Tag] IN { "AB", "A", "ABC" } )

        ),

    "B",

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', [Tag] IN { "AB", "ABC", "BC", "B" } )

        ),

    "C",

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', [Tag] IN { "ABC", "BC" } )

        )

)

vkalyjmsft_1-1636940278651.png

 

Best Regards,
Community Support Team _ kalyj

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

4 REPLIES 4
Kriekis
Frequent Visitor

Hi,

I see that measure [Result] can be more dynamic as well.

So try the measure below:

 

Result2 =
VAR TagsInSegment =
FILTER(
ADDCOLUMNS(
SUMMARIZE(
ALLSELECTED('Table'),
'Table'[Tag]
),
"IsTagInSegments", NOT ISEMPTY (
FILTER (
'Table (2)',
FIND('Table (2)'[Type],'Table'[Tag],,0) > 0
)
)
),
[IsTagInSegments]
)
RETURN
CALCULATE(
SUM('Table'[Value]),
KEEPFILTERS(TagsInSegment)
)
 
TRPBI
New Member

That works thanks

v-yanjiang-msft
Community Support
Community Support

Hi @TRPBI ,

According to your description, here’s my solution.

1.Create a table, there’s no relationship between the two tables.

vkalyjmsft_0-1636940278648.png

 

2.Create a measure.

Result =

SWITCH (

    SELECTEDVALUE ( 'Table (2)'[Type] ),

    "A",

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', [Tag] IN { "AB", "A", "ABC" } )

        ),

    "B",

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', [Tag] IN { "AB", "ABC", "BC", "B" } )

        ),

    "C",

        CALCULATE (

            SUM ( 'Table'[Value] ),

            FILTER ( 'Table', [Tag] IN { "ABC", "BC" } )

        )

)

vkalyjmsft_1-1636940278651.png

 

Best Regards,
Community Support Team _ kalyj

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

Greg_Deckler
Community Champion
Community Champion

@TRPBI Well of course not, all of your C's are in your A's and B's. So you have a disconnected table for A, B and C selection or ? I'm not exactly clear on this one.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.