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
stanislav_dugas
Helper III
Helper III

Sumx with Meassure

Hi Guys i need help with adjusting my sumxfunction.

 

I have 2 tables.

1st:

Country

ProductAPN

UK

A20

UK

B10
USA30
USB10

2nd:

CountryExpenses
UK100
US200

 

Both tables have relationship via Country. And what i would like to calculate is the expeses after aplying factor per individual product. Expenses are allocated via the amount of Premium (APN).

 

Hence i created meassure to have factor for individual product and country like this since i will be looking at the allocation only per individual country.

 Factor = DIVIDE(SUM(Data[APN]),CALCULATE(SUM(Data[APN]),ALLSELECTED()))

So for UK the visual will look like this.

CountryProductAPNFactor
UKA200,67
UKB100,33

 

And now i need to to do sumx where i need to split the expenses from the second tabel and bring it into first one.

What i made is this but it is not working as it should.

SUMX(VALUES(Data[Product)]),[Factor]*SUM(Expenses[Expenses]))

 

My final visual should look like this but instead i get 300 for each product.

CountryProductAPNFactorExpenses
UKA200,6767
UKB100,3333

 

Any idea what am i doing wrong?

Thank you.

2 ACCEPTED SOLUTIONS
VijayP
Super User
Super User

@stanislav_dugas 

While using an expression from other table , use RELATED Function. Try let me know that worked?




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


View solution in original post

parry2k
Super User
Super User

@stanislav_dugas solution attached, check measures in APN table, there are few more tables in the model, just ignore those.

 

For this post, APN and Expenses are the relevant tables.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@stanislav_dugas solution attached, check measures in APN table, there are few more tables in the model, just ignore those.

 

For this post, APN and Expenses are the relevant tables.

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thx alot this solved another problem now my factor is calculated properly even when looking on various countries at once 🙂 thx alot

VijayP
Super User
Super User

@stanislav_dugas 

While using an expression from other table , use RELATED Function. Try let me know that worked?




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Perfect this solved my problem Related function brought the expenses into my main table and then i was able to quickly calculate it 🙂 thx alot

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.