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

Power BI | Slicer Filter | Summary Table generation

I have a requirement in which I have transformed data in a Table which has say 10 rows. Another table has same columns but has some different data say another 10 columns. Both these tables have a row "total" which displays aggregated data at the end. I want to build another table in the report which gives the total from both these tables. But I am not able to link these tables with any relationship. So slicer filter visualization applies the filter on individual tables but does not reflect changes on summary table. Can you suggest how to acheive filtering throughout the report in this scenario? Or any other approach would also be appreciated. FYI I am preprocessing data from raw JSON. Below given is an example for the same. 

 

Table 1:-

IDTypeValue1Value2
1A1015
2A1015
3A1015
  3045

 

Table 2:-

IDTypeValue1Value2
1B2520
2B2520
3B2520
  7560

 

Summary:-

 ABTotal
Value13075105
Value24560105

 

Column "ID" is used to apply filter using slicer visualization. In this case when we change ID in slicer filter, table 1 and 2 reflects changes but summary table doesn't as they don't have any relation. How to link them in power BI or any other approach to acheive the same?

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Viktor001 

You need to create dimension tables that hold the unique values for ID and Type that you link to your fact tables, then you can use measures to summarize your data.  You can use DAX to create the tables:

 

IDs = 
DISTINCT(
        UNION(
            DISTINCT('Table 1'[ID]),
            DISTINCT('Table 2'[ID])
    )
)
Types = 
DISTINCT(
        UNION(
            DISTINCT('Table 1'[Type]),
            DISTINCT('Table 2'[Type])
    )
)

 

Then create the relationships like this.

jdbuchanan71_0-1630707415397.png

Then some measure to do the sums and add the type (from your types table) to a visual.  In my sample I put the measures on the IDs table but you can put them on whatever table you want.

jdbuchanan71_2-1630707483772.png

I have attached my sample file for you to look at.

 

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Viktor001 

You need to create dimension tables that hold the unique values for ID and Type that you link to your fact tables, then you can use measures to summarize your data.  You can use DAX to create the tables:

 

IDs = 
DISTINCT(
        UNION(
            DISTINCT('Table 1'[ID]),
            DISTINCT('Table 2'[ID])
    )
)
Types = 
DISTINCT(
        UNION(
            DISTINCT('Table 1'[Type]),
            DISTINCT('Table 2'[Type])
    )
)

 

Then create the relationships like this.

jdbuchanan71_0-1630707415397.png

Then some measure to do the sums and add the type (from your types table) to a visual.  In my sample I put the measures on the IDs table but you can put them on whatever table you want.

jdbuchanan71_2-1630707483772.png

I have attached my sample file for you to look at.

 

Thanks a lot for the solution. It works fine. But can you suggest how to do the same if we only have 1 table by merging Table 1 and Table 2. And we want to achieve the same goal of summarizing Data based on Type.

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.