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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
gunner
Frequent Visitor

Help with Time difference between multiple rows & Index

Hi guys, I had previously marked this as solved but I have noticed something which is throwing off my calculations. I am using an
index field to calculate the difference between the times of an item being acquired and it being released.

The query language for the index is from earlier in this thread and it wokrs fine until an item is acquired and released at the
exact same time for a user. The Index assigns both actions the same value, which throws out the calculations quite substantially.


Example in the image below, where the last 2 lines an item is acquired and released at same time and both are assigned the same
index value (17). Ideally i want the index to assign the value of 17&18, or even just disregard this altogether as the
corresponding time value would be zero. I have tested it by manually deleting those last 2 entries from the datasource and the
calculations are perfect. I need same values to be removed, or assigned the correct index value. Thank you if you can help.

 

Index Query:

Index = 
IF (
    OR ( 'OpenLicenseUsage-9601427'[Action] = "Released", 'OpenLicenseUsage-9601427'[Action] = "Acquired" ),
    RANKX (
        FILTER (
            ALL ( 'OpenLicenseUsage-9601427'),
            OR ( 'OpenLicenseUsage-9601427'[Action] = "Released", 'OpenLicenseUsage-9601427'[Action] = "Acquired" )
                && 'OpenLicenseUsage-9601427'[User] = EARLIER ( 'OpenLicenseUsage-9601427'[User] )
        ),
        'OpenLicenseUsage-9601427'[Timestamp (UTC)],
        ,
        asc
    )
)

Capture.JPG

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @gunner,

 

I would suggest you add an index in the Query Editor and then make a little change of your formula. 

Index = 
IF (
    OR ( 'OpenLicenseUsage-9601427'[Action] = "Released", 'OpenLicenseUsage-9601427'[Action] = "Acquired" ),
    RANKX (
        FILTER (
            ALL ( 'OpenLicenseUsage-9601427'),
            OR ( 'OpenLicenseUsage-9601427'[Action] = "Released", 'OpenLicenseUsage-9601427'[Action] = "Acquired" )
                && 'OpenLicenseUsage-9601427'[User] = EARLIER ( 'OpenLicenseUsage-9601427'[User] )
        ),
        'OpenLicenseUsage-9601427'[Index],
        ,
        asc
    )
)

 

Best Regards,

Dale

Community Support Team _ Dale
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

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @gunner,

 

Could you please mark the proper answer as a solution?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @gunner,

 

I would suggest you add an index in the Query Editor and then make a little change of your formula. 

Index = 
IF (
    OR ( 'OpenLicenseUsage-9601427'[Action] = "Released", 'OpenLicenseUsage-9601427'[Action] = "Acquired" ),
    RANKX (
        FILTER (
            ALL ( 'OpenLicenseUsage-9601427'),
            OR ( 'OpenLicenseUsage-9601427'[Action] = "Released", 'OpenLicenseUsage-9601427'[Action] = "Acquired" )
                && 'OpenLicenseUsage-9601427'[User] = EARLIER ( 'OpenLicenseUsage-9601427'[User] )
        ),
        'OpenLicenseUsage-9601427'[Index],
        ,
        asc
    )
)

 

Best Regards,

Dale

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

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.