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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
HankScorpio2
Frequent Visitor

Sum and filter a table based on a condition in another table

hi 

 

I am trying to create a total possible score for each evaluation. The total can be different for each evaluation due to N/a marking for some criteria.

 

I have this example data from my report. 

The first table is so evaluation results named QualityData and the second table is the max possible score for each section named MarkReference.. 

 

 

 

Evaluation Date
 (dd/mm/yyyy)
Agent2.12.22.33.13.23.34.14.25.15.25.35.45.56.16.26.36.47.17.27.3
15/01/2025 0:00Same Person353107357510101073333444
16/01/2025 0:00Same Person350107350 101010733304 4
17/01/2025 0:00Same Person3031003570101010730334 4

 

SectionMark

2.13
2.25
2.33
3.110
3.27
3.33
4.15
4.27
5.15
5.210
5.310
5.410
5.57
6.13
6.23
6.33
6.43
7.14
7.24
7.34

 

What I am trying to do is sum the sections in MarkReference table for each evaluation  filtering out the sections that are blank in the QualityData table. So that for this person I should end up with a result set like this. 

 ResultPossible score
 109109
 87100
 85105
Totals281314

 

This is the formula I am using 

 

 

Possible Score = CALCULATE(SUMX(MarkReference,MarkReference[Mark]),FILTER(QualityData, QualityData[Value] <> BLANK()))

 

and tried this version also without success. It keeps summing up the filter not the table sumx is on.

Max Score = CALCULATE(SUMX(RELATEDTABLE(MarkReference), [Mark]), FILTER(QualityData, QualityData[Value] <> BLANK()))

 

It doesn't sum MarkReference however, it sums the filter value and I am returned the Result values instead of the Possible Score values as in the table above. 

 

How can I acheive this?

 

1 ACCEPTED SOLUTION
Pangane
Frequent Visitor

Hi

 

Please follow below steps to achieve expected results.

 

Step 1 :- 

Unpivot section columns from QualityData Table using Power Query. so, that you will get all sections in one column.

 

Step 2:-

Then create relationship between both table using Section Column. one to Many Relationship

 

Step3 :-

You will get correct results for Actual Score without any context modification

 

Step 4:

For getting Possible Score, Use below formula.

Possible Score =
        CALCULATE(
                    SUM(MarkReference[Marks]),
                    CROSSFILTER(MarkReference[Section],QualityTable[Section],Both)
        )
 
Pangane_0-1737024680036.png

 

 
Please accept solution, if it resolve your issue.
 
Thanks & Regards
Pravin Angane

 

 

 

 

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @HankScorpio2,

Any update on this? Did these suggestions suitable with your requirement?

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
v-shex-msft
Community Support
Community Support

Hi @HankScorpio2 ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Pangane
Frequent Visitor

Hi

 

Please follow below steps to achieve expected results.

 

Step 1 :- 

Unpivot section columns from QualityData Table using Power Query. so, that you will get all sections in one column.

 

Step 2:-

Then create relationship between both table using Section Column. one to Many Relationship

 

Step3 :-

You will get correct results for Actual Score without any context modification

 

Step 4:

For getting Possible Score, Use below formula.

Possible Score =
        CALCULATE(
                    SUM(MarkReference[Marks]),
                    CROSSFILTER(MarkReference[Section],QualityTable[Section],Both)
        )
 
Pangane_0-1737024680036.png

 

 
Please accept solution, if it resolve your issue.
 
Thanks & Regards
Pravin Angane

 

 

 

 

saud968
Super User
Super User

1. Data Preparation

Ensure Consistent Data Types: Make sure the Value column in QualityData and the Mark column in MarkReference are of the same data type (e.g., both numbers).
Clear Relationships: Define a clear relationship between the two tables. This relationship should be based on the Section column (assuming you have a Section column in both tables to link them).
2. DAX Formula

Possible Score =
CALCULATE(
SUM(MarkReference[Mark]),
FILTER(
MarkReference,
RELATED(QualityData[Value]) <> BLANK()
)
)

Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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