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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
santoshhmsam50
Frequent Visitor

hierarchy filter based on the tables that are with many to many relationship

I have a table with  a LIKE 

CUSTOMER 
LABCCA

 

20

LCBA 

50

LDCC 

 

 

And tabbel B as same format 

abcsaleSession
LCBA 50032443
LDBC 111343
LA CA2234324
LD CA333Need Help34434

I want to create the  visulization with the  filterwith Hierarchy on a, b,c  th Show and Tellat can cover both the table  , looks to be the data model and DAX support

@DA @dax @rajendra 

@Ritaf1983

Ritaf1983

 

2 ACCEPTED SOLUTIONS
v-kongfanf-msft
Community Support
Community Support

Hi @santoshhmsam50 ,

 

You need to create the following relational columns in each table and then create hierarchical tables. Then apply the following formula to the metric table.

CombinedKey = [a] & "|" & [b] & "|" & [c]
HierarchyTable = DISTINCT(
    UNION(
        SELECTCOLUMNS('TableA', "a", [a], "b", [b], "c", [c]),
        SELECTCOLUMNS('TableB', "a", [a], "b", [b], "c", [c])
    )
)

vkongfanfmsft_0-1719539871760.png

SumCustomer = 
CALCULATE(
    SUM(TableA[CUSTOMER]),
    TREATAS(
        VALUES(HierarchyTable[CombinedKey]),
        TableA[CombinedKey]
    )
)
SumSales = 
CALCULATE(
    SUM(TableB[sale]),
    TREATAS(
        VALUES(HierarchyTable[CombinedKey]),
        TableB[CombinedKey]
    )
)

vkongfanfmsft_1-1719539934555.png

 

Best Regards,
Adamk Kong

 

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

Thanks a lot for  solving and explaining it in such a simple way 🙂

View solution in original post

2 REPLIES 2
v-kongfanf-msft
Community Support
Community Support

Hi @santoshhmsam50 ,

 

You need to create the following relational columns in each table and then create hierarchical tables. Then apply the following formula to the metric table.

CombinedKey = [a] & "|" & [b] & "|" & [c]
HierarchyTable = DISTINCT(
    UNION(
        SELECTCOLUMNS('TableA', "a", [a], "b", [b], "c", [c]),
        SELECTCOLUMNS('TableB', "a", [a], "b", [b], "c", [c])
    )
)

vkongfanfmsft_0-1719539871760.png

SumCustomer = 
CALCULATE(
    SUM(TableA[CUSTOMER]),
    TREATAS(
        VALUES(HierarchyTable[CombinedKey]),
        TableA[CombinedKey]
    )
)
SumSales = 
CALCULATE(
    SUM(TableB[sale]),
    TREATAS(
        VALUES(HierarchyTable[CombinedKey]),
        TableB[CombinedKey]
    )
)

vkongfanfmsft_1-1719539934555.png

 

Best Regards,
Adamk Kong

 

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

 

Thanks a lot for  solving and explaining it in such a simple way 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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