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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
RIDWIV
Helper I
Helper I

Difference in time from one IP to another

Hello Power BI family,

I want to find the diiffrence in time from one ip to another when any client id is chosen. Any solution how we can reach to this query. 

RIDWIV_0-1686032316943.png

RIDWIV_1-1686032335609.png

RIDWIV_2-1686032474929.png

 

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @RIDWIV ,

 

Here's my solution.

1.Create a calculated column to get the rankings group by Client ID based on datetime.

Rank = RANKX(FILTER('Table',[Client ID]=EARLIER('Table'[Client ID])),[Login Date & Time],,ASC,Dense)

vstephenmsft_0-1686199089785.png

Then you can use DATEDIFF function to get the time intervals.

Seconds = var _pre=CALCULATE(MAX('Table'[Login Date & Time]),FILTER(ALL('Table'),[Client ID]=MAX('Table'[Client ID])&&[Rank]=MAX('Table'[Rank])-1))
var _cur=MAX('Table'[Login Date & Time])
return DATEDIFF(_pre,_cur,MINUTE)

vstephenmsft_1-1686199249529.pngvstephenmsft_2-1686199255897.png

vstephenmsft_3-1686199262353.png

When you use the slicer, the time interval from one IP to another in chronological order in the Client ID is displayed.  

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

please cross check my formula 

Rank = RANKX(FILTER('login_list',[clientid]=EARLIER('login_list'[clientid])),[loginDateTime],,ASC,Dense)
Seconds = var _pre=CALCULATE(MAX('login_list'[loginDateTime]),FILTER(ALL(login_list),[clientid]=MAX('login_list'[clientid])&&login_list[Rank]=MAX(login_list[Rank])-1))
var _cur=MAX(login_list[loginDateTime])
return DATEDIFF(_pre,_cur,SECOND)

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hi @RIDWIV ,

 

Here's my solution.

1.Create a calculated column to get the rankings group by Client ID based on datetime.

Rank = RANKX(FILTER('Table',[Client ID]=EARLIER('Table'[Client ID])),[Login Date & Time],,ASC,Dense)

vstephenmsft_0-1686199089785.png

Then you can use DATEDIFF function to get the time intervals.

Seconds = var _pre=CALCULATE(MAX('Table'[Login Date & Time]),FILTER(ALL('Table'),[Client ID]=MAX('Table'[Client ID])&&[Rank]=MAX('Table'[Rank])-1))
var _cur=MAX('Table'[Login Date & Time])
return DATEDIFF(_pre,_cur,MINUTE)

vstephenmsft_1-1686199249529.pngvstephenmsft_2-1686199255897.png

vstephenmsft_3-1686199262353.png

When you use the slicer, the time interval from one IP to another in chronological order in the Client ID is displayed.  

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

 

please cross check my formula 

Rank = RANKX(FILTER('login_list',[clientid]=EARLIER('login_list'[clientid])),[loginDateTime],,ASC,Dense)
Seconds = var _pre=CALCULATE(MAX('login_list'[loginDateTime]),FILTER(ALL(login_list),[clientid]=MAX('login_list'[clientid])&&login_list[Rank]=MAX(login_list[Rank])-1))
var _cur=MAX(login_list[loginDateTime])
return DATEDIFF(_pre,_cur,SECOND)

Hello @Anonymous , i tried but differences in time is not coming, please let me know what else I can do

RIDWIV_0-1686221742004.png

 

Anonymous
Not applicable

Hi @RIDWIV ,

 

Does your rank column return the same result as mine?

Also you can modify the measure return _pre to check if there is a problem.

vstephenmsft_1-1686279022786.png

 

 

Judging by the screenshot, it seems that you might have more than one table. Isn't the clientid in your formula the same as the Client ID in the slicer? Similarly, isn't the clientid of your formula the same as the Client ID in the table visual? If possible, provide your data model, i.e. your tables and columns, and the relationships between tables. Please provide virtual data to protect your privacy.

vstephenmsft_0-1686278448200.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

Hii,

I found my mistake. I was applying formula on column intead of using measure tool. but still there is issue like i am not getting full value, please check

 

RIDWIV_0-1686301336871.png

 

 

I have done name formatting

please send me your mail id, i will send you the table.....and rank is working same as yours

Mahesh0016
Super User
Super User

@RIDWIV Please Share Your ENDOUTPUT For Better Understanding.

 

End output is not there

 

@RIDWIV No It's Not .

i mean it is not available in the table

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.