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
PBlearner27
Helper I
Helper I

Dynamic filtering to create multiple columns

I have a set of data (Table 1) that looks like this:

PBlearner27_0-1598129860226.png


I have another table (Table 2) that looks like this:

PBlearner27_1-1598129989862.png

 

1. The codes in the "Type A" and "Type B" columns of Table 2 correspond to the codes in the column "Code" in Table 1.  I am trying to sum the "Data Point" values based on these corresponding codes between the two tables. 

 

2. I also need to apply the filters "Investment/Settlement", "TypeA/B" and "Outcome" to get the appropriate sums in the respective cells.

 

3. The codes follow a hierarchy structure, therefore some of the codes such as "LMN500" and "QRST600" are the uppermost parents. 

 

4. Row Header 1 (highlighted in blue) is the sum of the yellow rows beneath (Row A - Row D with filter "Investment"), and likewise for Row Header 2 (sum of Row A- RowD with filter "Settlement"). 

 

My end goal is to get an outcome like this (where the Xs refer to the calculated numbers):

PBlearner27_2-1598131138373.png

 

5. Because multiple columns cannot have a relationship with a single column in another table, I've though of creating 3 seperate tables (2a, 2b and 2c) like this and then combining columns 1, 2 and 3 to get the desired result as displayed above. 

 

PBlearner27_4-1598131512324.pngPBlearner27_5-1598131541912.pngPBlearner27_6-1598131655937.png

 

Therefore:
6. Given the above conditions - I need a bit of help with the appropriate DAX formula to calculate columns 1, 2 and 3. Considering the hierarchy structure in place for the codes, I suspect the DAX formula may use the function "CONTAINS" to search for the corresponding code in the "Merged Column" column in Table 1.  Open to any other suggestions!! 

 

7. For what I'm trying to achieve - is this an effient/approrpiate manner of going about it? I have c. 50 other tables that follow a similar structure and would need to apply the same method to them. Ultimately I want to be able to show the results using a Table visual in the reporting view - open to any suggestions, I am pretty new to Power Bi 🙂 

Thank you for your time!!

 

 

 





 

 



 

2 REPLIES 2
pranit828
Community Champion
Community Champion

HI @PBlearner27 

 

I would unpivot the table 2 on column 2,3 and 4 instead of creating three seperate tables so that my DAX formula becomes easier to manage. Also, if you have 50 other table you may consider using one column at the begining which says the table number.

pranit828_0-1598132930076.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

@pranit828 Thank you very much for taking the time to respond, however this isn't what I was looking for! 🙂 

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.