cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thigs
Helper III
Helper III

Counting for days between?

Hi!

 

I have four columns in my dataset. The first is Order Number, the second is Number of Boxes, the third is the Packed Date, the fourth is the date it was Shipped Date. What I want to find is how many boxes I am holding in my warehouse on any given date. 

So, if I have five boxes that are being packed on the 10th but shipped on the 20th and I am looking at the 15th, I'd need to count those. Do you have any ideas for how to do this (ideally in a measure)? To make matters a little more complicated, not all dates I need would appear in the dataset. For instance, if I want to look at something on the 15th but that 15th date doesn't actually pack or ship on that day, it's not there, so I'm thinking I'll need a date table to link everything together. 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Thigs , You need to follow a approach like this

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Thigs , You need to follow a approach like this

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Hi!

This is mostly working, but I wanted to post it here just in case I did something wrong, as I did have to massage the formula a little - 

 

Current Boxes = CALCULATE(SUMX(FILTER('Pack and Hold','Pack and Hold'[Pack Date]<=max('Date'[Date]) && (ISBLANK('Pack and Hold'[Ship Date]) || 'Pack and Hold'[Ship Date]>(max('Date'[Date])-1))),('Pack and Hold'[Boxes])),CROSSFILTER('Pack and Hold'[Pack Date],'Date'[Date],None))

The main thing I changed was changing it to a sumx instead of countx and also making the ship date > max of the date -1, as I needed to include the date it was shipping as a day we are hanging onto the box, as we are hanging onto it for at least part of that day. Is that how I would do that? 

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors