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
mtyoung99
Frequent Visitor

Distinct count of Shipment records over time

All,

 

I am needing to get a count of shipment status's over time.

 

My SHIP table has two dates I need to consider, Demand Date (Date it should ship) and Ship Date (actual date it did ship).

 

I created a DC Demand Date table to use specifically for this problem. It is a simple date table.

 

I need to be able to count on any given day the number and status of the shipments.

 

My problem is comparing one date (DC Demand Date[DC Demand Date]) to two dates (SHIP[Demand Date], SHIP[Ship Date]).

 

All of my attempts have been in DAX measures so far. I am trying to avoid Power Query as the Ship table is very big and I have already backed up all of the transformations to SQL Server to improve performance.

 

I have tried combinations of relating, not relating, etc.

 

TableHeaderDemand DateShip Date
SHIP13/12/20213/15/2021
SHIP13/12/20213/15/2021
SHIP23/15/20213/20/2021
SHIP33/15/20213/15/2021
SHIP43/15/20213/15/2021
SHIP43/15/20213/15/2021
SHIP53/15/20213/15/2021
SHIP63/15/2021 

 

Needed result:

TableDC Demand DateCarryoverCurrentCarryover ShipCurrent Ship
DC Demand Date3/12/20210100
DC Demand Date3/13/20211000
DC Demand Date3/14/20211000
DC Demand Date3/15/20211513
DC Demand Date3/16/20212000
DC Demand Date3/17/20212000
DC Demand Date3/18/20212000
DC Demand Date3/19/20212000
DC Demand Date3/20/20212010
DC Demand Date3/21/20211000

 

1 ACCEPTED SOLUTION

Hi, @mtyoung99 

Thank you very much for your feedback.

Please check the below picture.

I created two tables, which are date-table and ship-table, and they are connected via TWO-Inactive-Relationship.

Please also check the link down below. All measures are in the pbix file.

I hope this helps.

 

Picture2.pngPicture3.png

 

https://www.dropbox.com/s/5fnfpt2cn8wtgwj/mtyoung99.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi, @mtyoung99 

I only could calculate shipments count after demand & before ship.

I think this is what you meant by Carryover. Other than Carryover, I could not understand.

The below is the measure that I wrote for "Shipments count after demand & before ship".

In this case, I had no relationship  ( or inactive relationship)  between the two tables. If you have one active relationship, you can add  ALL  or  Allselect  function into the measure to inactivate the relationship.

 

Shipments count after demand before ship =
CALCULATE (
COUNTROWS ( Ship ),
FILTER (
VALUES ( Ship[Demand Date] ),
Ship[Demand Date] <= MAX ( 'DC Demand Date'[DC Demand Date] )
),
FILTER (
VALUES ( Ship[Ship Date] ),
Ship[Ship Date] > MIN ( 'DC Demand Date'[DC Demand Date] )
)
)
+ CALCULATE (
COUNTROWS ( Ship ),
FILTER (
VALUES ( Ship[Demand Date] ),
Ship[Demand Date] <= MAX ( 'DC Demand Date'[DC Demand Date] )
),
FILTER ( VALUES ( Ship[Ship Date] ), Ship[Ship Date] = BLANK () )
)
 
Picture1.png
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Hoping this helps explain what I am after. 

I am wanting to keep track of how any orders drop to a DC (on the day they should Ship), if they ship, if not then they would be carried over to the next day as carryover until they do ship.

x1.png

Hi, @mtyoung99 

Thank you very much for your feedback.

Please check the below picture.

I created two tables, which are date-table and ship-table, and they are connected via TWO-Inactive-Relationship.

Please also check the link down below. All measures are in the pbix file.

I hope this helps.

 

Picture2.pngPicture3.png

 

https://www.dropbox.com/s/5fnfpt2cn8wtgwj/mtyoung99.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Jihwan,

That is exactly what I am after. Brilliant!!

Thank you sir!!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.