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,
Im trying to create a new Measure to calculate the kgm3 for our industry types based on jobs that we have done. I have written the query in SQL but the Power BI measure is giving me a different result, the sql query is:
SELECT IndustryType.Name, SUM(WeighData.Weight) as Weight, SUM(ContainerType.Capacity) as Volume, SUM(WeighData.Weight) / (SUM(ContainerType.Capacity)/1000) as Kgm3 FROM Customer Customer INNER JOIN Site Site on Site.CustomerId = Customer.Id INNER JOIN Agreement Agreement on Agreement.SiteId = Site.Id INNER JOIN ContainerType ContainerType on ContainerType.Id = Agreement.ContainerTypeId INNER JOIN IndustryType IndustryType on IndustryType.Id = Site.IndustryTypeId INNER JOIN Job Job on Job.AgreementId = Agreement.Id INNER JOIN WeighData WeighData on WeighData.JobId = job.Id where job.RecordCreationDate > '2019-01-01' group by IndustryType.Name
The results from sql is:
The power Bi Measure for Weight is correct but the volume is way off.
Here is my model diagram, the relationships Cross filter direction is set to both
My Measure are:
@nmaddock can you possibly share pbix file wiht sample data, t is bit of complex by looking at relationship diagram. remove any sensitive data before sharing.
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.
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 |
---|---|
114 | |
100 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |