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
85dhruv
Frequent Visitor

Sum based on a value coming from another table

Hello,

 

I am very new to DAX and PowerBI in general so incase this is already answered then please let me know.

 

So i have 2 tables

Main Opportunity Table
Oppoutunity Id Sale (EURm)
11110
22215
33320
44425
55530

 

Upsell Table
Main opportunityUpsell Opportunity
111555
111444
222333

 

Now i would like to see

 

Main OppUp Sell Sales (EUR m) 
11155(sum of 555 and 444 from main table)
22220(sum of 333 from main table)

 

I have tried to read upon parent-child and use Path but that required the child (Upsell id) to have all the parent ids (Main opp id) - which i dont have 

 

Can someone please guide me how to get to this ?

 

Thanks

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-diye-msft
Community Support
Community Support

Hi @85dhruv ,

 

Set the relationship as below:

3.PNG

 

then add the measure:

Measure = IF(MAX('Upsell Table'[Main opportunity])=BLANK(),BLANK(),CALCULATE(SUM('Main Opportunity Table'[Sale (EURm)]),ALL('Upsell Table'),VALUES('Upsell Table'[Main opportunity])))
Result shown as below:
4.PNG
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

6 REPLIES 6
85dhruv
Frequent Visitor

Thanks @v-diye-msft @Ashish_Mathur , both accepted solutions worked . i used the one without the Merge since the table size i am handling is huge and it was taking a lot of time to create another table.

 

 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-diye-msft
Community Support
Community Support

Hi @85dhruv ,

 

Set the relationship as below:

3.PNG

 

then add the measure:

Measure = IF(MAX('Upsell Table'[Main opportunity])=BLANK(),BLANK(),CALCULATE(SUM('Main Opportunity Table'[Sale (EURm)]),ALL('Upsell Table'),VALUES('Upsell Table'[Main opportunity])))
Result shown as below:
4.PNG
Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mussaenda
Super User
Super User

Hi,

 

I am not sure if this is what you are looking for

I set the relationship like this:

2019_07_20_11_59_07_Untitled_Power_BI_Desktop.png

Active: Opportunity ID -> Main Opportunity

Inactive: Opportunity Id <-> Upsell Opportunity

 

Untitled.png

Then I created a measure (See above)

edmar_502
Frequent Visitor

Hi @85dhruv 

Have your heard about the bridge table, perhaps it could be help you.

 

Additionally, study SUMX Dax function: https://docs.microsoft.com/en-us/dax/sumx-function-dax

 

https://www.seerinteractive.com/blog/join-many-many-power-bi/ 

 

 

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.