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.
Hi. I have 2 tables, order_lines and order_create_purchase_price. I have a relationship between id and order_lines_id.
What I need to calculate is order_create_purchase_price.purchase_price * order_lines.quantity - order_create_purchase_price.VAT(this is tax% from price), so I can get purchase price from all without tax. Any help?
order_lines table
id | quantity | price |
433368 | 1 | 2,5 |
433369 | 2 | 1,5 |
order_create_purchase_price table
order_lines_id | purchase_price | vat |
433368 | 3,5 | 10 |
433369 | 2,35 | 10 |
I have this measure when I count something from 1 table without tax(here 'alv'), but I can't handle it with 2 tables.
Solved! Go to Solution.
Hi @Anonymous ,
What is the relationship between your tables, one-to-many, one-to-one, or many-to-many?
Do you want to calculate the purchase_price* quantity - purchase_price* quantity*( vat/100)?
For example, the id 433681 calculates 35 * 1 – 35 * 1 * (10 / 100) = 32
If yes, we create a one-to-one relationship based on your sample data.
Then we can create a measure to get the result.
Measure =
SUM ( order_create_purchase_price[purchase_price] )
* SUM ( order_lines[quantity] )
* (
1
- SUM ( order_create_purchase_price[vat] ) / 100
)
If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?
It will be helpful if you can show us the exact expected result based on the tables.
Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
Hi @Anonymous ,
How about the result after you follow the suggestions mentioned in my original post?
Could you please provide more details or expected result about it If it doesn't meet your requirement?
If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
What is the relationship between your tables, one-to-many, one-to-one, or many-to-many?
Do you want to calculate the purchase_price* quantity - purchase_price* quantity*( vat/100)?
For example, the id 433681 calculates 35 * 1 – 35 * 1 * (10 / 100) = 32
If yes, we create a one-to-one relationship based on your sample data.
Then we can create a measure to get the result.
Measure =
SUM ( order_create_purchase_price[purchase_price] )
* SUM ( order_lines[quantity] )
* (
1
- SUM ( order_create_purchase_price[vat] ) / 100
)
If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?
It will be helpful if you can show us the exact expected result based on the tables.
Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
@Anonymous - Use RELATED or RELATEDTABLE. Please post sample data as text and expected output from sample data and can be more specific.
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |