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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
romoguy15
Helper IV
Helper IV

Create Custom Group By Filter for Different Scenarios

Hello, I have a list of codes in a column. I am trying to group this list of codes into three different groups. The problem I am running into is the groups each all contain the same values but slightly different groups and there for, I have to create the grouping to be all separte. I would like to to have all these three buckets into one filter. For example, below are my codes. My first bucket or group, I want to show All Codes, the next bucket, I want it to show me only BNG, CBT, DBP. My last group, I want it to show me only BNG and CBT. 

 

I also have some sample data
https://1drv.ms/u/s!AqID1H0nHPOzhBBrARqPZO1Lfyjv?e=c9SeKG

 

romoguy15_0-1652476403555.png

 

The way I have it set up now is it is basically three separate groups in three separate filters which is not very ideal. 

romoguy15_1-1652476911695.png

 

Thank you in advance for any help.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @romoguy15 

 

You can try the following methods.

Measure:

Measure =
IF (
    SELECTEDVALUE ( 'Table'[Code] ) = "BNG",
    1,
    IF (
        SELECTEDVALUE ( 'Table'[Code] ) = "CBT",
        1,
        IF ( SELECTEDVALUE ( 'Table'[Code] ) = "DBP", 1, 0 )
    )
)

Place this Measure in the Code slicer's view and set it to equal 1.

vzhangti_0-1652951949450.png

In this slicer, not selecting any of them is All Codes. Hold down CTRL to select BNG and CBT, or BNG, CBT and DBP. You can achieve one slicer to filter three cases.

vzhangti_2-1652952194759.pngvzhangti_1-1652952179554.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @romoguy15 

 

You can try the following methods.

Measure:

Measure =
IF (
    SELECTEDVALUE ( 'Table'[Code] ) = "BNG",
    1,
    IF (
        SELECTEDVALUE ( 'Table'[Code] ) = "CBT",
        1,
        IF ( SELECTEDVALUE ( 'Table'[Code] ) = "DBP", 1, 0 )
    )
)

Place this Measure in the Code slicer's view and set it to equal 1.

vzhangti_0-1652951949450.png

In this slicer, not selecting any of them is All Codes. Hold down CTRL to select BNG and CBT, or BNG, CBT and DBP. You can achieve one slicer to filter three cases.

vzhangti_2-1652952194759.pngvzhangti_1-1652952179554.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

I think this is a good workaround to achieve. For some reason, bringing the filter into the real data, it just doesn't filter the table because there are calculation sums in the table that won't change with the filter. I believe that is because the calculations are sums but have filters within those sums.

romoguy15
Helper IV
Helper IV

Good Morning @CNENFRNL , I have updated the sample data with a version 2 to give more context. 

https://1drv.ms/u/s!AqID1H0nHPOzhBBrARqPZO1Lfyjv?e=c9SeKG

romoguy15
Helper IV
Helper IV

Hi @CNENFRNL , unfortunately this method only works in the sample data environment. When I bring in the formula to my real report it get the MdxScript error. The codes I am using are not actually put into a table to view by row. The codes just filter a simple table that has calculation totals by column. Would it help If I changed the sample file to include much more info and try to replicate the exact table I am referring to?

romoguy15_0-1652706395250.png

 

CNENFRNL
Community Champion
Community Champion

Tricky solution, assign different weights to members of different buckets,

CNENFRNL_0-1652503175818.png

 

Record_2022_05_14_06_36_01_395.gif

 

 


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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