Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SK_
New Member

Calculate Storage Cost based on Date Range Selected

Hi, I'm trying to work out how much the storage cost would be over the next few weeks/months (based on a date range selected using a slicer) but seem to be getting mixed results with everything I've tried. 

 

I have a fixed price for weekly storage cost per pallet. I'm trying to make a calculated column and/or measure that will take that fixed weely storage cost and calcuate the cost over the coming weeks/months based on what the user selects. 

I have tried several different things like getting the number of weeks offset from my calendar table (based on last date selected in slicer return the number of weeks this is away from the first date) and then multiple the storage per week cost by that number, which should be correct but the result is not as expected. I end up with really high numbers.

 

Below is an example with the last column being the expected outcome.

Data Slicer (Slider)07/01/202404/02/20244 Weeks
    
SKUPallet QuantityWeekly Storage CostBased on Date Range Selected
Product 10.5£2.50£10.00
Product 21£5£20
Product 32£10£40

 

Any help would be much appreciated.

1 ACCEPTED SOLUTION
zenisekd
Super User
Super User

Create a measure that would work this way: 
COST BASED =  DISTINCTCOUNT ('DateRange'[weeks]) * SUM('Product'[Weekly storage])

View solution in original post

2 REPLIES 2
SK_
New Member

Thank you very much zenisekd, this is working as expected!

zenisekd
Super User
Super User

Create a measure that would work this way: 
COST BASED =  DISTINCTCOUNT ('DateRange'[weeks]) * SUM('Product'[Weekly storage])

Helpful resources

Announcements
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.