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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kyrpav
Helper IV
Helper IV

calculate sum with criteria from many columns of another filtered table

Hello i want to sum a column but i need to filter the table based on data from another table.

So i have table1 where i want to sum points and i want to sum only the record that for the dates and the names and the classes i find in table 2

 

namesdatesclasspoints
george2020-01-01math10
george2020-02-01physic13
george2020-05-01physic16
george2020-06-01chem19
george2020-07-01math22
mairi2020-01-01math25
mairi2020-02-01physic28
mairi2020-05-01physic31
mairi2020-06-01chem34
mairi2020-07-01math37
nick2020-01-01math40
nick2020-02-01physic43
nick2020-05-01physic46
nick2020-06-01chem49
nick2020-07-01math52
helen2020-01-01math55
helen2020-02-01physic58
helen2020-05-01physic61
helen2020-06-01chem64
helen2020-07-01math67
sundy2020-01-01math70
sundy2020-02-01physic73
sundy2020-05-01physic76
sundy2020-06-01chem79
sundy2020-07-01math82

 

And table2 

namedateclasses
george2020-01-01math
mairi2020-02-01physic
nick2020-05-01physic
helen2020-06-01chem
sundy2020-07-01math

 

I am using measure like this:

 

Measure 3 = CALCULATE(sum(Table1[points]);Table1[name] in (ALLSELECTED(Table2[name]));Table1[date] in (ALLSELECTED(Table2[date]));Table1[class] in (ALLSELECTED(Table2[class]))) but it does not filter properly, 
 
is there any better way to do this?
3 REPLIES 3
nhoward
Resolver I
Resolver I

@kyrpav 

 

That depends on how and where you want to display that result.  A simple way is have a relationship between the 2 tables based on Name.  You can then just use a Sum measure, and let the relationships and table do the filtering. 

then in a table visual put:

 

image.pngimage.png

My problem is that connection is many to many and even when i try to join all 3 columns i get the same classic problem where it does not find solution and places everywhere the same number.

Anonymous
Not applicable

instead of allselelcted try ALLEXCEPT. As it will keep filters on those columns which you mentioned in ALLEXCEPT.

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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