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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
zcec
New Member

Summing from multiple tables AFTER slicers

Hi,

 

I have several tables (15+) which look like this:

 

Table 1

QuestionWeightingcategoryResponse
17

A

Yes

10

A

No

 

Table 2

QuestionWeightingCategoryResponse
210

A

Yes

20

A

No

 

Table 3

QuestionWeightingCategoryResponse
18

B

Yes

10

B

No


etc.

 

I have a slider for each table which the user can select between yes and no for. This returns a weighting. 

What I want to do is create a table which compiles all the weightings for each category. For the above, it would look something like this if the slicer is set to Yes for all three questions:

 

CategoryScore
A17
B8

 

I'm having trouble creating this final table, though. 

 

I'd really appreciate any help with this. 

Many thanks

1 ACCEPTED SOLUTION

Here is a way using the appended tables. You need to create Yes/no Tables for every question and link them to the appended table using inactive relationships. This is how the model looks like:

model.jpg

Create measures for every question as follows:

Sum Weight 1 = 
CALCULATE(SUM(Append1[Weighting]), USERELATIONSHIP(Append1[Response],'Resonse 1'[Response 1]))
Sum Weight 2 = 
CALCULATE(SUM(Append1[Weighting]), USERELATIONSHIP('Append1'[Response],'Resonse 2'[Response 2]))

Set up a slicer using the corresponding Response table and add the measure for each response. Select the tabel visual and set the filter for the corresponding question.

Filter.jpg

 

to get

Questions 1.gif

 

I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

9 REPLIES 9
PaulDBrown
Community Champion
Community Champion

Append all the tables in Power Query

append.jpg

 Optional but recommended:
Create a dimension table for Category. Select new table under modeling and:
dim.jpgmodel.jpg

Create a measure for the sum of wieghting:

Sum Weight = 
SUM(Append1[Weighting])

Create a table visual with the field from the dimension table and the measure to get:

Result.jpg

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul,


Thanks for the reply. 

This is similar to Vahid's idea but unfortunately, when I set a filter for Q1 on No, I can't set the filter for Q2 and 3 to Yes. 

Here is a way using the appended tables. You need to create Yes/no Tables for every question and link them to the appended table using inactive relationships. This is how the model looks like:

model.jpg

Create measures for every question as follows:

Sum Weight 1 = 
CALCULATE(SUM(Append1[Weighting]), USERELATIONSHIP(Append1[Response],'Resonse 1'[Response 1]))
Sum Weight 2 = 
CALCULATE(SUM(Append1[Weighting]), USERELATIONSHIP('Append1'[Response],'Resonse 2'[Response 2]))

Set up a slicer using the corresponding Response table and add the measure for each response. Select the tabel visual and set the filter for the corresponding question.

Filter.jpg

 

to get

Questions 1.gif

 

I've attached the sample PBIX file





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul,

 

Thank you! This is exactly what I need!!

Can't thank you enough!

You can create yes/no tables to use as extra slicers and measures





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi  @zcec ,

Here are the steps you can follow:

1. Create table with Enter data.

vyangliumsft_0-1647581683773.png

2. There is no relationship between the newly created table and the other three tables

vyangliumsft_1-1647581683775.png

3. Create measure.

Score =
var _select=SELECTEDVALUE('Table1'[Response])
var _tabel1=CALCULATE(SUM('Table1'[Weighting]),FILTER(ALL(Table1),'Table1'[category]=MAX('Category_Table'[Category])&&'Table1'[Response]=_select))
var _table2=CALCULATE(SUM('Table2'[Weighting]),FILTER(ALL(Table2),'Table2'[category]=MAX('Category_Table'[Category])&&'Table2'[Response]=_select))
var _table3=CALCULATE(SUM('Table3'[Weighting]),FILTER(ALL(Table3),'Table3'[category]=MAX('Category_Table'[Category])&&'Table3'[Response]=_select))
return
IF(
    MAX('Category_Table'[Category])="A",_tabel1+_table2,_table3)

4. Result:

vyangliumsft_2-1647581683776.png

Best Regards,

Liu Yang

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

Thanks for working on this!

I've just tried it out, though, and it seems to only work  for the response given to Q1. I tried tweaking the formula slightly and bringing in a response slicer for each of the questions but selecting a response in one Q filters down the available responses in the remaining questions

VahidDM
Super User
Super User

Hi @zcec 

 

In Power Query, first Append all tables:

 

VahidDM_0-1647391134758.png

 

 

Then in the new table, Click on the Group By and group your table based on the Category and Sum of the Weighting:

 

VahidDM_2-1647391271696.png

 

 

 

 

Output:

VahidDM_3-1647391287700.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

 

Hi Vahid,

 

Thanks for the reply!

I've just followed your steps but unfortunately, it doesn't seem to retain the slicer selections. 

 

I created a sample dashboard to show what I mean but I can't seem to attach it here. Here are some screenshots instead:

 

PowerBiMXM_1-1647427949268.png

 

 

I did have a go at creating a measure which sort of works but it doesn't show up against each category, only against each Q ID:

 

PowerBiMXM_2-1647427999318.png

PowerBiMXM_3-1647428038789.png

 

 

Thanks

 

P.S. I'm the same person! I've just logged on using my work account!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.