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
DCPics
Helper I
Helper I

Creating a measure that can calculate 2 dynamically filtered values

I have a problem a couple of us have been trying to solve for a few days now.  We have multiple manufacturing locations and when we plan a part to be built, we have a "Planned WH", but that isn't always what happens in reality.  We also log the "Shipping WH", and planned may not always match the shipped.

 

I have a BI dashboard created that looks at how many pieces we planned for certain wharehouses, and that data is mapped, and has a card that shows the number of pieces.  I also have another map which shows our shipping warehouse and all shipments that were sent within 500 miles of that location.

 

I am trying to come up with a measure that can tell me the difference in the two metrics.

 

In the example I attached, you'll see the Planned WH and sales (Count) come from the "Sales" table.  I also have a table with distances from each warehouse called "Zip Miles" and that one is joined on Shipping WH so I can see how far it was to our customer.

 

If you look at Planned WH 1, we planned for 22 units to be shipped out of there, but only 17 went to customers within 500 miles.

 

I need a measure that can subtract those two values and tell me that we were off plan by 5 units.....or in the Planned WH 2 example shown, we were off by 10 units.

 

Thank you very much for your help with this, it's been driving me nuts for days.Example.JPG  

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi, @DCPics 

How to calculate Shipping WH(500) " but only 17 went to customers within 500 miles"

I think you should create a WH fact table, then create relationships with Sales and Zip Miles, respectively.

Then drag WH field from WH fact table and new measure [planned wh count] - [shipping wh count].

 

If it is not your case, please share simple pbix file or some data sample and expected output. Do mask sensitive data before uploading.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I am still having problems.  I am running into an issue with it being an Many to Many relationship.  The problem is apparently that we can ship orders incomplete, and then send another delivery later.  So, I tried what you suggested, and created a key of order number, line number, qty, and ship date, but I am still getting multiples.

 

I'm going to give something a try today and will post here if it works.

 

Thank you.

DCPics
Helper I
Helper I

FYI, the 500 miles can be hard coded, we are only looking for shipments within 500 miles of our shipping locations.

 

Thank you again for your help with this!

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.