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 August 31st. Request your voucher.

Reply
zantarel
Frequent Visitor

Calculating Changes on the fly between two tables

Hi all 

Been struggling with this one and hoping someone can help ... so I've got a couple of Tables - let's call them Scores and Uplifts.

 

Scores: 

Name

Score

A

2

B2
C1
D3
E2

Uplifts:

ItemNameScore Uplift
Item 1A0.5
Item 2A1.0
Item 1B0.5
Item 3E0.5

 

What I want to do is calculate the the averages of the numbers, based on the 'Item' selected. 
The current average is easy - just Average (NumberColumn) = (2+2+1+3+2)/5 = 2

But then I want a way of saying based on the Items selected, the new average would be: XX 
i.e. Selecting Item 1 and 2, the new average would be: ((2+0.5+1)+(2+0.5)+1+3+2 )/6= 2.4 

Because Items 1 and 2 both affect A, so both of their uplifts need to be added to A. Whereas B is only being uplifted by Item 1, and I've not selected Item 3, so that uplift of 0.5 hasn't been included. 

 

If I do this as a calculated column, I can easily lookup the score value and add the uplift onto that, but then when I average that, the original score essentially gets added twice - i.e. I'd end up with the below, which gives a different average, and then when I select only Items 1 and 2, the average score will just be those scores, not all scores but just those uplifts. 

ItemNameScore Upliftoriginal ScoreUplifted score
Item 1A0.522.5
Item 2A1.023
Item 1B0.522.5
Item 3E0.522.5



I don't seem to be able to get this to work at all and my brain just can't work out the logic I need to do this in a measure... I hope this makes sense... 

 

Thanks in advance

1 ACCEPTED SOLUTION

It sounds like either there's a relationship between scores and uplifts, which there shouldn't be, or the relationship between the names table and uplift is bi-directional, which it shouldn't be. The relationship from names to both tables and uplift should be single direction so that names filters the other tables, but the other tables do not filter names.

View solution in original post

5 REPLIES 5
FreemanZ
Super User
Super User

hi @zantarel ,

 

try like:

measure =

DIVIDE(

    SUM(uplifts[score uplift]) + SUM(scores[score]),

    DISTINCTCOUNT(scores[name])

)

 

or?

johnt75
Super User
Super User

If you have a separate table of the names, which links to both scores and uplifts, you can use that in the visual and write a measure like

Combined Average =
DIVIDE (
    SUM ( Scores[Score] ) + SUM ( Uplifts[Score Uplift] ),
    COUNTROWS ( Scores ) + COUNTROWS ( Uplifts )
)

Ok, so I was overthinking this a little bit and that has helped. The problem is, when I filter it by the item, it removes all Names that aren't related to that Item. 
So the overall averages work a treat if all items are selected.  but the problem comes when I filter it. so I do have a table with just the names in it, which has links to both the scores and the uplifts tables. so if i do all the calculations within the names table, but the filter is based on the items in uplifts, it removes any item in the names table that doesn't have that item. and then averages are just the averages of those items, not all items with those uplifts. 
for the example above, that means I'm getting: an average of 2 with no uplifts - great. 

And if I do all scores + all uplifts / count of rows = 2.5  - great 😄 

but then if i filter the visual to just show me items 1+2, that's giving me the average of (2.5+3.5)/2 = 3  whereas it should be 2.4 - it's ignoring the Names of stuff that doesn't have that mapping. and short of mapping every Item to every Name with a value of 0 which is kinda crazy and would be a very very big table, i'm not sure how to get to the average i'm looking for? 



It sounds like either there's a relationship between scores and uplifts, which there shouldn't be, or the relationship between the names table and uplift is bi-directional, which it shouldn't be. The relationship from names to both tables and uplift should be single direction so that names filters the other tables, but the other tables do not filter names.

oh! I forgot about the relationships part of it... I think I've got it then! Thank you so much!! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.