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

Not sum up in Parent-Child hierarchy

Hello,

 

I am working with data that is structured in a parent-child relationship which up to 12-levels. Every level already has its own value as per their ID. My objective is to display the value that is shown at every level and not roll up the sum between parent and child as I need the parent-child relationship in PowerBI for drill through purposes. The blank value in Level 3 also the child of Level 2 (which has the same ID) . 

As for my DIM_INDICATOR table has flat hierarchy which only have ID and PARENTID. I have created the hierarchy using PATH functions. Attached is the sample dataset that's similar to my current project.


This content is similar to my case 
https://community.powerbi.com/t5/Desktop/Do-not-sum-certain-columns-in-matrix-Show-values-based-on-f...


I tried to do the same approach but still not get the right outcome. Maybe because I'm using PATH function and not suitable to use the approach.


Sample dataset

LEVEL 1LEVEL 2LEVEL 3VALUE
VEHICLE  2345
 BUS 567
  BUS-A78
  BUS-B56
 CAR 456
  CAR-A234
  CAR-B33
  CAR-C123
 LORRY 765
  LORRY-A343
  LORRY-B122
  LORRY-C5
 PLANE 123
  PLANE-A45
  PLANE-B34
  PLANE-C21

 

Sample DIM_KPI

DIM_KPI_IDIDPARENTIDVEHICLE_NAME
1100 VEHICLE
2101100BUS
3102100CAR
4103100LORRY
5104100PLANE
6105101BUS
7106101BUS-A
8107101BUS-B
9108102CAR
10109102CAR-A
11110102CAR-B
12111102CAR-C
13112103LORRY
14113103LORRY-A
15114103LORRY-B
16115103LORRY-C
17116104PLANE
18117104PLANE-A
19118104PLANE-B
20119104PLANE-C

 

Thank you.

 

@Ashish_Mathur 

3 REPLIES 3
nazrinf
Frequent Visitor

Hi Ashish,

 

I have both ID and ParentID present in a dimension table called DIM_KPI.  The value is taken from fact table called FACT_VEHICLE. In fact table only have the DIM_KPI_ID, DIM_MONTH and the value. Both tables connected with DIM_KPI_ID.

 

I created the hierarchy using PATH function. By creating the hierarchy, the PARENT is showing at CHILD level too with the same ID. For example, CAR has ID and PARENTID as CAR is the PARENT for CAR-A, CAR-B and CAR-C. But in my case, CAR also appear as blank with value at child row.  Something like the picture below.

The parent value should be the same as the blank row in child as it has the same ID. When collapse the row, the value showing 155,963.56 not summing up the child.

 

nazrinf_1-1659169239513.png

 

I created calculated column as below but not give me the desired result.

CALCULATE (VALUES('FACT Env'[Value]),
FILTER(ALL('DIM KPI'), 'DIM KPI'[ID] = EARLIER('FACT Vehicle'[Indicator Id])))

 

Is my explanation clear?

 

Thank you.

Ashish_Mathur
Super User
Super User

Hi,

Are ID and Parent ID already columns present in your source data table - can thy be taken as given?  How did you get the numbers in the output table?  


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Did you ever end up figuring this out? I've also run into the same issue. 

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.

Top Solution Authors