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
RJD515
Regular Visitor

Need Help - Measure

Hello,

I am a newbie to Power BI and need some help with a measure i am trying to create.

 

I am trying to get total cost of orders based on a look-up between 2 tables and i have the below but itis not working.

 

Value of Orders = CALCULATE ( SUM ( 'rma mm_standard_cost'[MAX_STD_COST_EA] ), FILTER ( 'rma sr_order_line', 'rma sr_order_line'[PART_NUMBER] = RELATED('rma mm_standard_cost'[MATERIAL]) ) )

 

RMA is the DB

MM Standard Cost is table 1...has Material and MAX_STD_COST_EA as 2 fields

SR Order Line is another table...which has a field called the Part_Number

 

Thanks in advance

Desikan Narayanan

1 ACCEPTED SOLUTION
v-sihou-msft
Employee
Employee

@RJD515

 

You may modify you formula like below: 

 

Value of Orders =
CALCULATE (
    SUM ( 'rma mm_standard_cost'[MAX_STD_COST_EA] ),
    FILTER (
        ALL ( 'rma mm_standard_cost'[MATERIAL] ),
        CONTAINS (
            VALUES ( 'rma sr_order_line'[PART_NUMBER] ),
            'rma sr_order_line'[PART_NUMBER], 'rma mm_standard_cost'[MATERIAL]
        )
    )
)

Please also refer to this article: 

 

From SQL to DAX: Joining Tables

 

Regards,

View solution in original post

5 REPLIES 5
v-sihou-msft
Employee
Employee

@RJD515

 

You may modify you formula like below: 

 

Value of Orders =
CALCULATE (
    SUM ( 'rma mm_standard_cost'[MAX_STD_COST_EA] ),
    FILTER (
        ALL ( 'rma mm_standard_cost'[MATERIAL] ),
        CONTAINS (
            VALUES ( 'rma sr_order_line'[PART_NUMBER] ),
            'rma sr_order_line'[PART_NUMBER], 'rma mm_standard_cost'[MATERIAL]
        )
    )
)

Please also refer to this article: 

 

From SQL to DAX: Joining Tables

 

Regards,

parry2k
Super User
Super User

Can you share how your tables are related that will help to answer you question. 



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.

RJD515
Regular Visitor

Hello,

I am trying to write a measure to cauclate the total cost of orders based on materials by looking up the standard cost from another table.

I have the below...but it is not working. Can someone help this newbie pls?

 

Value of Orders = CALCULATE ( SUM ( 'rma mm_standard_cost'[MAX_STD_COST_EA] ), FILTER ( 'rma sr_order_line', 'rma sr_order_line'[PART_NUMBER] = RELATED('rma mm_standard_cost'[MATERIAL]) ) )

 

MM Standard cost has the Material and the cost...SR Order Line has the Part Number that was submitted in the order.

 

Thanks in advance

 

Desi 

Hi @RJD515,

 

Share the link from where i can download your file.  Show the expected result/visual that you want.


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

Seems to be a duplicate post 🙂



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.

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.