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
TrentS
Advocate II
Advocate II

Best approach for Date sequence check

Good day to all,

 

I have about 20 events/dates in a shipping sequence that I need to run a check on.
I need to determine two things:

1. Any missing dates in the sequence (think missing scans during the process)

2. If any dates are out of sequence.

TrentS_0-1713204518980.png

Using the screenshot above.
1. I would need a count of the two rows missing dates. (Lets just call it per row at this stage, so 2 in this case.)
2. In order 105 (yellow) obviously we cannot pack it after shipping so I need to capture that.

Ultimately I would like to produce those rows in an output visual table as well as a count.


I have a secondary table that ranks the sequence to use as a reference. (Static/Imported)
Given the high number of events, nested IFs and Switch do not seem to be elegant solutions as I have seen in my search of this forum.

Suggestions on how to approach this?
I appreciate your time!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@TrentS 

you can create two measures

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table', ISBLANK('Table'[order processed])||ISBLANK('Table'[packed])))
Measure 2 = CALCULATE(COUNTROWS('Table'),FILTER('Table', 'Table'[packed]>'Table'[shipping]))
11.PNG
 
or create columns
missingdate = if(ISBLANK('Table'[order processed])||ISBLANK('Table'[packed]),1,0)
wrongdate = if('Table'[packed]>'Table'[shipping],1,0)
 
then you sum the column to get the total number
12.PNG
 
pls see the attachment below
 
 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
TrentS
Advocate II
Advocate II

Thank you Ashish and Ryan. Kudos given.
I am going to leave it as unresolved for a bit as I worry about upscaling that to the 20+ dates that would have to be used in those measures/columns. This data set already has a considerable number of custom columns added and I worry about adding even more.
Any thoughts on an approach to that many steps needing the comparisons? (I only placed 4 in the example but there are considerably more in the actual data set.)

Ashish_Mathur
Super User
Super User

Hi,

Write these calculated column formulas

Missing dates = 1*(Data[Order placed]=BLANK()||Data[order processed]=BLANK()||Data[packed]=BLANK()||Data[shipped]=BLANK())
Dates ordered properly = 1*(if(Data[Missing dates]=1,BLANK(),not(Data[order processed]>=Data[Order placed]&&Data[packed]>=Data[order processed]&&Data[shipped]>=Data[packed])))

Hope this helps.

Ashish_Mathur_0-1713236139318.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@TrentS 

you can create two measures

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table', ISBLANK('Table'[order processed])||ISBLANK('Table'[packed])))
Measure 2 = CALCULATE(COUNTROWS('Table'),FILTER('Table', 'Table'[packed]>'Table'[shipping]))
11.PNG
 
or create columns
missingdate = if(ISBLANK('Table'[order processed])||ISBLANK('Table'[packed]),1,0)
wrongdate = if('Table'[packed]>'Table'[shipping],1,0)
 
then you sum the column to get the total number
12.PNG
 
pls see the attachment below
 
 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.