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
BraedonCook
Regular Visitor

Flag Missing Rows Based on Date/Time

Hi All,

 

I have a list that looks like this:

Bag NumberDateandTimeTransactionType
110/08/2020 8:00amSign Out
110/08/2020 2:00pmSign In
210/08/2020 9:00amSign Out
310/08/2020 10:00amSign Out
310/08/2020 4:00pmSign In
211/08/2020 9:00amSign Out
211/08/2020 3:00pmSign In


As you can see, bag number 2 was never signed back in,

What I am looking to do is flag, if a bag wasn't signed back in within 12 hours,

ie:

Bag NumberDateandTimeTransactionTypeSignedIn?
110/08/2020 8:00amSign Out 
110/08/2020 2:00pmSign In 
210/08/2020 9:00amSign OutFALSE
310/08/2020 10:00amSign Out 
310/08/2020 4:00pmSign In 
211/08/2020 9:00amSign Out 
211/08/2020 3:00pmSign In 

 

Any assistance with this would be greatly appreciated

(also I'm unsure if this was posted in the right section)

6 REPLIES 6
v-rzhou-msft
Community Support
Community Support

Hi @BraedonCook 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

Hi Rico,

While this didn't end up solving my issue, we have engaged a partner to assist with building out our solution,
Not sure if you could ever call this one resolved, but I can delete the post if needed?

v-rzhou-msft
Community Support
Community Support

Hi @BraedonCook 

Build a table like yours to have a test.

1.png

Build a calculated column:

 

Rank = RANKX(FILTER(ALL('Table'),'Table'[Bag Number]=EARLIER('Table'[Bag Number])),'Table'[DateandTime],,ASC)

 

Build a measure to achieve your goal:

 

Measure = 
VAR _a = MAX('Table'[DateandTime])
VAR _b = CALCULATE(MAX('Table'[DateandTime]),FILTER(ALL('Table'),'Table'[Rank]=MAX('Table'[Rank])+1&&'Table'[Bag Number]=MAX('Table'[Bag Number])))
RETURN
IF(DATEDIFF(_a,_b,HOUR)>12,"FALSE",BLANK())

 

Result:

 2.png

You can download the pbix file from this link: Flag Missing Rows Based on Date/Time

 

Best Regards,

Rico Zhou

 

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

 

amitchandak
Super User
Super User

@BraedonCook , Try like

if(isblank(countx(filter(Table, [DateandTime] >=earlier([DateandTime]) && [DateandTime] <=earlier([DateandTime]) Time(12,0,0) && [TransactionType] ="Sign In"),[Bag Number])),blank(),"FALSE")

Hi @amitchandak 

It's saying "syntax for 'Time' is incorrect"

@BraedonCook , try

 

if(isblank(countx(filter(Table, [DateandTime] >=earlier([DateandTime]) && [DateandTime] <=earlier([DateandTime]) + Time(12,0,0) && [TransactionType] ="Sign In"),[Bag Number])),blank(),"FALSE")

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.