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
DivyaJohn
Regular Visitor

Parent Child Parameter

 

Hello,

 

I need help for a scenario, which Im struggling with right now...

 

Below is the data , which has a Parent Id ,Customer Id and Name. Customer Id is Unique and Names without a Parent Id is the Parent and its corresponding ID under Parent Id column is the Child.

 

Im trying to create a parameter for Parent ID Like 'Select Parent' It should have only Parent Name like as in the below example its A,B,C. Selecting any Parent it should list the Customers of the Parent.

 

Any help regarding this scenario would be greatly appreciated. Thanks!

 

 

 

Customer IdParent IdName
131AA
141BB
151CC
1 A
162DD
172EE
2 B
3 C
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @DivyaJohn ,

To achieve this in Power BI, you can follow these steps:

  1. Load the data into Power BI.

  2. Create a new table with the distinct values of Parent Id and Name from the original table.

  3. Create a relationship between the new table and the original table using the Parent Id column.

  4. Create a new parameter by going to the "Modeling" tab and selecting "New Parameter". Name the parameter "Select Parent" and set the data type to "Text".

  5. Create a new measure to calculate the count of customers for the selected parent:

Customer Count = CALCULATE( COUNT('Original Table'[Customer Id]), FILTER( 'Original Table', 'Original Table'[Parent Id] = LOOKUPVALUE('New Table'[Parent Id], 'New Table'[Name], [Select Parent]) ) )

  1. Create a table visual with the Name column from the new table and the Customer Count measure.

  2. Add a slicer visual for the "Select Parent" parameter.

The table visual will show the count of customers for each parent, and the user can select a parent from the slicer to dynamically change the Customer Count measure.

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @DivyaJohn ,

To achieve this in Power BI, you can follow these steps:

  1. Load the data into Power BI.

  2. Create a new table with the distinct values of Parent Id and Name from the original table.

  3. Create a relationship between the new table and the original table using the Parent Id column.

  4. Create a new parameter by going to the "Modeling" tab and selecting "New Parameter". Name the parameter "Select Parent" and set the data type to "Text".

  5. Create a new measure to calculate the count of customers for the selected parent:

Customer Count = CALCULATE( COUNT('Original Table'[Customer Id]), FILTER( 'Original Table', 'Original Table'[Parent Id] = LOOKUPVALUE('New Table'[Parent Id], 'New Table'[Name], [Select Parent]) ) )

  1. Create a table visual with the Name column from the new table and the Customer Count measure.

  2. Add a slicer visual for the "Select Parent" parameter.

The table visual will show the count of customers for each parent, and the user can select a parent from the slicer to dynamically change the Customer Count measure.

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.