Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Guys i need help with adjusting my sumxfunction.
I have 2 tables.
1st:
Country | Product | APN |
UK | A | 20 |
UK | B | 10 |
US | A | 30 |
US | B | 10 |
2nd:
Country | Expenses |
UK | 100 |
US | 200 |
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.
Country | Product | APN | Factor |
UK | A | 20 | 0,67 |
UK | B | 10 | 0,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.
Country | Product | APN | Factor | Expenses |
UK | A | 20 | 0,67 | 67 |
UK | B | 10 | 0,33 | 33 |
Any idea what am i doing wrong?
Thank you.
Solved! Go to Solution.
While using an expression from other table , use RELATED Function. Try let me know that worked?
Proud to be a 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.
@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
While using an expression from other table , use RELATED Function. Try let me know that worked?
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
User | Count |
---|---|
141 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
123 | |
101 | |
71 | |
61 |