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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
SebV
Advocate I
Advocate I

Visualising child data and parent data from the same fact table in two separate table visuals

Hi,

I like to show in addition to a table showing the number of inhabitants for selected districts or neighbourhoods a table with the number of inhabitants of the matching parent area: the municipality, the province and the entire country.

 

The nature of the source data makes that the child levels don’t add up to it’s parent level. So for example, the sum of the inhabitants of the districts do not equal the number of inhabitants of the municipality. Therefore the user has to select at which arealevel they like to analyse the data.

In order to give additional perspective to the data, I like to show, as mentioned before, the figures of the related parent area levels in a second separate table:

Scherm­afbeelding 2024-07-07 om 08.38.36.jpg

 And when selecting another district:

Scherm­afbeelding 2024-07-07 om 08.39.25.jpg

The above images show the desired outcome, which I am not able to achieve yet.

 

I use a measure ('Relevant parent area')  to determine whether a parent are is relevant to show or not.  

The difficulty comes from the fact that the Dim_Area table and the Fact table both are being filtered by slicers. That information is needed to determine the relevant parent areas. At the same time these slicers filter the Fact table and therefore prevent showing the values from the relevant parent areas. 

Editing the interactions between the slicers and the parent area table makes the values return, but also removes the slicer information to determine the relevant parent areas.

I duplicated the Dim_Area table in order to determine the relevant parent areas. Is it needed to duplicate the fact table as well to achieve this or is there another solution? In the original model the fact table consists of multiple fact tables each being rather large. Duplication is therefore not my first preference.. Furthermore, a field parameter is used to determine what columns to show equally in both tables. 

 

An unpivoted view of the data:

Scherm­afbeelding 2024-07-07 om 08.15.23.jpg

PBIX-file and Excel datafile attached:

https://www.dropbox.com/scl/fo/a5fitksgp9hm4ycvf9gee/AG5QR3-1nKT8kaoPuBL1p7A?rlkey=ui12vthaw4f3mwdv2... 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @SebV 

You can refer to the following solution.

1.In dim_areas create the following calculated column

 

 

PV_IDS = var a=MAXX(FILTER(Dim_Areas,CONTAINSSTRING([Area_type],0)),[Area_id])
RETURN IF(CONTAINSSTRING([Area_type],1),a,Dim_Areas[Related PV_id])

 

 

 

2.I removed the dim_duplicate table. and create a new table. There is no relationship with this table.

 

 

Table =
VAR a =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "0" ) ),
        [Area_name],
        [Area_id],
        [PV_IDS]
    )
VAR b =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "1" ) ),
        [Area_name],
        [Area_id],
        [PV_IDS]
    )
VAR c =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "2" ) ),
        [Area_name],
        [Area_id],
        [Related PV_id]
    )
VAR d =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "3" ) ),
        [Area_name],
        [Area_id],
        [Related MU_id]
    )
VAR e =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "4" ) ),
        [Area_name],
        [Area_id],
        [Related DI_id]
    )
RETURN
    UNION ( a, b, c, d, e )

 

And in the new table create a calculated column.

Path = var a=PATH('Table'[Area_id],'Table'[PV_IDS])
return SUBSTITUTE(a,[Area_id],"")

 3.Then create a calculated columns in dim_area table.

 

Pathdetail = LOOKUPVALUE('Table'[Path],'Table'[Area_id],[Area_id])

 

 

4.Then create the following measures.

 

 

Measure = IF(ISFILTERED(Dim_Areas[Related MU_name]),COUNTROWS(FILTER(Dim_Areas,CONTAINSSTRING([Pathdetail],MAX('Table'[Area_id])))),1)
Inhabitants_1 = CALCULATE(SUM(Fact_Inhabitants[Value]),'Fact_Inhabitants'[Indicator] = "Inhabitants",Fact_Inhabitants[Area_id] in VALUES('Table'[Area_id]),CROSSFILTER(Dim_Areas[Area_id],Fact_Inhabitants[Area_id],None))
Male inhabitants (%)_1 = CALCULATE(SUM(Fact_Inhabitants[Value]),'Fact_Inhabitants'[Indicator] = "Men (%)",Fact_Inhabitants[Area_id] in VALUES('Table'[Area_id]),CROSSFILTER(Dim_Areas[Area_id],Fact_Inhabitants[Area_id],None))

 

 

 

Then create a table visual, and put the following field to the visual.

vxinruzhumsft_0-1720419591496.png

And put the measure to the table visual filter.

vxinruzhumsft_1-1720419666753.png

 

Output

vxinruzhumsft_2-1720419681021.png

 

vxinruzhumsft_3-1720419693116.png

 

 

Best Regards!

Yolo Zhu

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

3 REPLIES 3
SebV
Advocate I
Advocate I

Wow! Thanks!
But, I don't understand how this solution works. Can you explain what the idea behind your solution is?

And one issue: both tables were originaly responding to the same field parameter.
In your solution the columns in the lower table don't  change when the field parameter is changed for the upper table.

Best Regards,
Sebastiaan

Anonymous
Not applicable

Hi @SebV 

Thanks for your quick reply, the logic of the solution is that create a new table to create the path for the levels, then you can use it, and for the second question, you need to create a new paramater for the two new measures.

 

Best Regards!

Yolo Zhu

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

Anonymous
Not applicable

Hi @SebV 

You can refer to the following solution.

1.In dim_areas create the following calculated column

 

 

PV_IDS = var a=MAXX(FILTER(Dim_Areas,CONTAINSSTRING([Area_type],0)),[Area_id])
RETURN IF(CONTAINSSTRING([Area_type],1),a,Dim_Areas[Related PV_id])

 

 

 

2.I removed the dim_duplicate table. and create a new table. There is no relationship with this table.

 

 

Table =
VAR a =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "0" ) ),
        [Area_name],
        [Area_id],
        [PV_IDS]
    )
VAR b =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "1" ) ),
        [Area_name],
        [Area_id],
        [PV_IDS]
    )
VAR c =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "2" ) ),
        [Area_name],
        [Area_id],
        [Related PV_id]
    )
VAR d =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "3" ) ),
        [Area_name],
        [Area_id],
        [Related MU_id]
    )
VAR e =
    SUMMARIZE (
        FILTER ( Dim_Areas, CONTAINSSTRING ( [Area_type], "4" ) ),
        [Area_name],
        [Area_id],
        [Related DI_id]
    )
RETURN
    UNION ( a, b, c, d, e )

 

And in the new table create a calculated column.

Path = var a=PATH('Table'[Area_id],'Table'[PV_IDS])
return SUBSTITUTE(a,[Area_id],"")

 3.Then create a calculated columns in dim_area table.

 

Pathdetail = LOOKUPVALUE('Table'[Path],'Table'[Area_id],[Area_id])

 

 

4.Then create the following measures.

 

 

Measure = IF(ISFILTERED(Dim_Areas[Related MU_name]),COUNTROWS(FILTER(Dim_Areas,CONTAINSSTRING([Pathdetail],MAX('Table'[Area_id])))),1)
Inhabitants_1 = CALCULATE(SUM(Fact_Inhabitants[Value]),'Fact_Inhabitants'[Indicator] = "Inhabitants",Fact_Inhabitants[Area_id] in VALUES('Table'[Area_id]),CROSSFILTER(Dim_Areas[Area_id],Fact_Inhabitants[Area_id],None))
Male inhabitants (%)_1 = CALCULATE(SUM(Fact_Inhabitants[Value]),'Fact_Inhabitants'[Indicator] = "Men (%)",Fact_Inhabitants[Area_id] in VALUES('Table'[Area_id]),CROSSFILTER(Dim_Areas[Area_id],Fact_Inhabitants[Area_id],None))

 

 

 

Then create a table visual, and put the following field to the visual.

vxinruzhumsft_0-1720419591496.png

And put the measure to the table visual filter.

vxinruzhumsft_1-1720419666753.png

 

Output

vxinruzhumsft_2-1720419681021.png

 

vxinruzhumsft_3-1720419693116.png

 

 

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.