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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Dynamic Filtering for Mekkos

Hi, 

 

I am new to the PowerBi forum and hope somebody is able to help solve something i truly believe to be possible! (we love Mekkos)

 

My question is around dynamic filtering with the PBI Mekko (or maybe i need to construct my own, who knows). 

 

A simple example of the format my data is in (not my actual dataset).

 

Category  Manufacturer  $ Value

A               Microsoft        1,000

B                Apple             2,000

C                Dell                500

B                HP                  350

C                Apple             500

B                Microsoft       500      

A                Lenovo          750  

A                Samsung       300      

 

A is $2,050

B is $2,850

C is $1,000

 

Now if i build a Mekko all the manufacturers will show up and be different coloured to show their respective share of A, B and C. However, what i am after is a way to select specific manufacturers and "categorize" the ones not selected as "other" so that way their data is still included in the calculation of the total category share (the goal is to enture that the category's A, B and C still hold the size as totalled above, but the filtering allows me to change the visual and recalculates the "other" share based on selections. Example:

 

Pick Apple, Microsoft and Lenovo. 

 

A has $1,750 for Micro and Lenovo (with $300 as "other")

B has $2,500 for Apple and Micro (with $350 as "other")

C has $500 for Apple (with $500 as "other")

 

This could then be recalculated if i were to pick Dell, HP and Apple - or some other combination. 

 

The utility of the above does not appear significant with such a small dataset, but i am dealing with >10,000 manufacturers in my actual data set. Any help on the DAX or anything required to build this would be much appreciated.

 

Thanks, 

 

Morgan.

2 ACCEPTED SOLUTIONS
ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
if you create another Dimension table for the manufacturers with an additional "Others" row, your measure could look like so:

 

Mekko = 
VAR __SelectedProductsValue =
    SUMX ( ALLSELECTED ( DimManufacturers_WithOthers[Manufacturer] ), [SumValue] )
VAR __AllManufacturersValue =
    CALCULATE ( [SumValue], REMOVEFILTERS(  DimManufacturers ) )
VAR __Result =
    SUMX (
        VALUES ( DimManufacturers_WithOthers[Manufacturer] ),
        IF (
            CALCULATE ( MAX ( DimManufacturers_WithOthers[Manufacturer] ) ) = "Others",
            __AllManufacturersValue - __SelectedProductsValue,
            [SumValue]
        )
    )
RETURN
    __Result

 

Please check out the file enclosed with details on how to connect the tables and which dimension fields to use where: 

... actually, if you just need it for the Mekko chart and don't need the totals to add up correctly, you can skip the SUM like so:

Mekko = 
VAR __SelectedProductsValue =
    SUMX ( ALLSELECTED ( DimManufacturers_WithOthers[Manufacturer] ), [SumValue] )
VAR __AllManufacturersValue =
    CALCULATE ( [SumValue], REMOVEFILTERS(  DimManufacturers ) )
VAR __Result =

        IF (
            CALCULATE ( MAX ( DimManufacturers_WithOthers[Manufacturer] ) ) = "Others",
            __AllManufacturersValue - __SelectedProductsValue,
            [SumValue]
        )

RETURN
    __Result

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
this should work for all charts. But you might want to try it out.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

3 REPLIES 3
ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
this should work for all charts. But you might want to try it out.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
if you create another Dimension table for the manufacturers with an additional "Others" row, your measure could look like so:

 

Mekko = 
VAR __SelectedProductsValue =
    SUMX ( ALLSELECTED ( DimManufacturers_WithOthers[Manufacturer] ), [SumValue] )
VAR __AllManufacturersValue =
    CALCULATE ( [SumValue], REMOVEFILTERS(  DimManufacturers ) )
VAR __Result =
    SUMX (
        VALUES ( DimManufacturers_WithOthers[Manufacturer] ),
        IF (
            CALCULATE ( MAX ( DimManufacturers_WithOthers[Manufacturer] ) ) = "Others",
            __AllManufacturersValue - __SelectedProductsValue,
            [SumValue]
        )
    )
RETURN
    __Result

 

Please check out the file enclosed with details on how to connect the tables and which dimension fields to use where: 

... actually, if you just need it for the Mekko chart and don't need the totals to add up correctly, you can skip the SUM like so:

Mekko = 
VAR __SelectedProductsValue =
    SUMX ( ALLSELECTED ( DimManufacturers_WithOthers[Manufacturer] ), [SumValue] )
VAR __AllManufacturersValue =
    CALCULATE ( [SumValue], REMOVEFILTERS(  DimManufacturers ) )
VAR __Result =

        IF (
            CALCULATE ( MAX ( DimManufacturers_WithOthers[Manufacturer] ) ) = "Others",
            __AllManufacturersValue - __SelectedProductsValue,
            [SumValue]
        )

RETURN
    __Result

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Hi ImkeF, 

 

Thank you for the quick response. 

 

I opened your solution in the PBI and noticed that you are using the "Treemap" rather than a a Marimekko chart (i am using "Mekko Chart 3.2.1").

 

Will this solution you have provided work across Treemap to my selected chart or will another solution be required? 

 

Thanks, 

 

Morgan. 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.