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
BUserTG
Frequent Visitor

Infer and apply filter across hierarchy

This requirement effectively goes against the foundations of tabular models, but interested if anyone has a solution. What I'd like to do is apply a filter on a column and have that filter context apply to another column at a higher level to dynamically calculate level of detail totals. Take the below dataset as example:

CategoryBrandProductSales

Food

OreoA10
FoodHeinzB20
FoodXYZC30
BeverageCokeD15
BeveragePepsiE25
BeverageXYZF35

 

What I'd like to do is allow users to apply a filter on Brand where, for example, Brand = 'XYZ' and it would return Category sales which would sum Food + Beverage to be 135 because Brand XYZ exists in both categories. In comparison, if I were to filter where Brand = 'Pepsi' then the Category sales measure would just return 75 for Beverage. The reason I cannot use an ALLEXCEPT() is because I don't want to force a selection on category, I want to be able to solely place a filter selection on Brand and have that infer the Category totals whether the mapping is one-to-one or one-to-many.

 

The goal ultimately is to be able to allow users to interact with a minimum number of filters while still being able to look at totals and averages across a category without having to explicitly select category in a filter. Thanks!

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @BUserTG ,

 

sure, that is possible.

Check the following measure:

Sales Category =
VAR vSummarizeTable =
    ADDCOLUMNS(
        VALUES( myTable[Category] ),
        "@Sales",
            CALCULATE(
                SUM( myTable[Sales] ),
                ALL( myTable[Brand] )
            )
    )
VAR vResult =
    SUMX(
        vSummarizeTable,
        [@Sales]
    )
RETURN
    vResult

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @BUserTG,

Did selimovd 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept his suggestion to help others who faced similar requirements to find it more quickly.

If these not help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
selimovd
Super User
Super User

Hey @BUserTG ,

 

sure, that is possible.

Check the following measure:

Sales Category =
VAR vSummarizeTable =
    ADDCOLUMNS(
        VALUES( myTable[Category] ),
        "@Sales",
            CALCULATE(
                SUM( myTable[Sales] ),
                ALL( myTable[Brand] )
            )
    )
VAR vResult =
    SUMX(
        vSummarizeTable,
        [@Sales]
    )
RETURN
    vResult

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

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.