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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sag_tyd
Frequent Visitor

Find all children based on selected parent slicer value?

Hello All,

 

New to PowerBI, please bare with me. 

 

I have monthly usage data from a SaaS software solution. You can read more about my data model in my previous post, but basically we get a usage report each month from a cloud deployment. All the monthly usage reports are pushed to the same table, and we have a separate table for a list of customers. 

 

The cloud deployment has three tiers of tenant: management, parent, and child. The management tenant is used to operate the platform and customers cannot access it. Customers are given a "parent" tenant, and they can create as many "child" tenants as they want. The data looks something like this:

 

Table 1: Usage Data

MonthTenant NameParent TenantPathUsage Metric(s)
Januarymanagement-management...
Januaryparent1managementmanagement|parent1 
JanuarychildAparent1management|parent1|childA 
JanuarychildBparent1management|parent1|childB 
Januaryparent2managementmanagement|parent2 
JanuarychildCparent2management|parent2|childC 
Februarymanagement-management 
Februaryparent1managementmanagement|parent1 
FebruarychildAparent1management|parent1|childA 
FebruarychildBparent1management|parent1|childB 
Februaryparent2managementmanagement|parent2 
FebruarychildCparent2management|parent2|childC 
...    

 

Table 2: Customer Mapping

Customer NameTenant Name
Customer1parent1
Customer2parent2

 

 

I want to build a report using a slicer on the "Customer Name" - so you select a customer name and it shows you metrics from not only the parent tenant, but also any child tenants. The only way I've been able to do this is add all the child tenants to Table 2. The problem is our customers can create their own child tenants each month, so that is not scalable. Ideally, selecting a customer name would be able to find all child tenants and display their data alongside the parent tenant data. 

 

I've tried the solutions mentioned below:

  1. https://community.powerbi.com/t5/Desktop/How-do-I-get-the-value-from-selected-slicer-and-then-filter... 
    This one looked promising, but still visualizations only contain the path up until tier 2. It does not drill down to tier 3. My code: 
    Path Contains Tenant = SEARCH(SELECTEDVALUE('Table2[Tenant Name]),SELECTEDVALUE(Table1[Path]),1,0)​


  2. https://community.powerbi.com/t5/Desktop/Select-all-children-from-Parent-based-on-1-child-selected/m...
    This one searches for all children under a parent based on a child. I'm looking to search for all children under a parent based on the parent

 

Thank you for any help you can provide! I apologize if this is easy - still learning how to best model my data to generate value. Much appreciated!

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @sag_tyd ,

 

Please try:

 

Path Contains Tenant =
VAR _SLICER =
    SELECTEDVALUE ( 'Table2'[Customer Name] )
VAR _TENANT =
    CALCULATETABLE (
        VALUES ( 'Table1'[Parent Tenant] ),
        FILTER ( ALL ( 'Table1' ), 'Table1'[Parent Tenant] = _SLICER )
    )
VAR _RESULT =
    IF (
        MAX ( 'Table1'[Tenant Name] )
            IN _TENANT
                && MAX ( 'Table1'[Parent Tenant] ) = _SLICER,
        1
    )
RETURN
    _RESULT

 

vcgaomsft_0-1668148616551.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Hello @v-cgao-msft,

 

I really appreciate you helping me!

 

Please help me check my understanding. In the file you attached, you did not have a data connection between the two tables:

sag_tyd_1-1668457511359.png

 

 

Whereas in my model, I drew a connection between "Tenant Name" in both tables. Why should I not have a connection between them? 

 

The code you provided is partially working. I think that it is not working entirely because some of the customers have more than one parent tenant. So, for example, customer1 may have parent1a and parent1b:

Customer NameTenant Name
Customer1parent1a
Customer1parent1b
Customer2parent2

 

It works great for the cases where a customer only has a single parent tenant. It is only when the customer has multiple parent tenants that it is not functioning. I apologies, I did not mention this in my original post as I did not know it would impact things and feared it would make my explanation more complicated. Any continued help is greatly appreciated. 

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.