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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
pgd
Frequent Visitor

Next Occurrence of Item

I have a Power BI dashboard linked to a SharePoint list. The sharepoint list has the following columns: the barcode value on the library book, who checked out the library book, the time they checked out the library book, the genre of library book, etc. 

 

I want to do a cycle time metric. I want to calcuate the time between when the library book was checked out (and scanned out of inventory) and when it was checked back in (the next time it appears scanned in the inventory). I need some type of unique identifier so that I can see when the book comes back to the library. I also need some type of formula that looks for the unique value and returns the difference between the check-out and check-in dates. Does anyone know the best way to approach this? Also, does anyone know which graphic would best represent this cycle time metric? I'm new to Power BI. 

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @pgd ,

 

This is my test table:

vyadongfmsft_0-1669273141457.png

 

Create a measure:

Datediff_check_out = 
VAR current_date =
    MAX ( 'Table'[Check out date] )
VAR previous_date =
    CALCULATE (
        MAX ( 'Table'[Check out date] ),
        FILTER (
            ALL ( 'Table'[Check out date] ),
            'Table'[Check out date] < current_date
        )
    )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Check out date] ),
        DATEDIFF ( previous_date, current_date, DAY ),
        BLANK ()
    )

 

 You can get the difference days between the check-out and  next time check-in dates for every Barcode of book:

vyadongfmsft_1-1669273263558.png

 

Best regards,

Yadong Fang

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

View solution in original post

1 REPLY 1
v-yadongf-msft
Community Support
Community Support

Hi @pgd ,

 

This is my test table:

vyadongfmsft_0-1669273141457.png

 

Create a measure:

Datediff_check_out = 
VAR current_date =
    MAX ( 'Table'[Check out date] )
VAR previous_date =
    CALCULATE (
        MAX ( 'Table'[Check out date] ),
        FILTER (
            ALL ( 'Table'[Check out date] ),
            'Table'[Check out date] < current_date
        )
    )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Check out date] ),
        DATEDIFF ( previous_date, current_date, DAY ),
        BLANK ()
    )

 

 You can get the difference days between the check-out and  next time check-in dates for every Barcode of book:

vyadongfmsft_1-1669273263558.png

 

Best regards,

Yadong Fang

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.