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
mayans
Frequent Visitor

Can this excell formula be done in PBI or Power query?

I have this data set. Where the 01:30 is being used as a parameter of time.

=IF(F2=D3,IF((E3-G2)<$I$1,E2,E3),E3)

=IF(F3=D4,IF((E4-G3)<$I$1,G4,G3),G3)

 

Any ideas?

 

        01:30
RECORDDATELoginTimeLogoutTimeLoginTimelogin_timeLogoutTimelogout_timeloginlogout
2021-01-05 00:002021-01-05 14:582021-01-05 22:4005/01/202114:5805/01/202122:4014:5823:00
2021-01-05 00:002021-01-05 22:502021-01-05 23:0005/01/202122:5005/01/202123:0014:5823:00
2021-01-06 00:002021-01-06 22:482021-01-07 06:3206/01/202122:4807/01/202106:3222:4807:06
2021-01-07 00:002021-01-07 06:592021-01-07 07:0607/01/202106:5907/01/202107:0622:4807:06
2021-01-07 00:002021-01-07 16:552021-01-07 23:1307/01/202116:5507/01/202123:1316:5523:13
2021-01-09 00:002021-01-09 06:552021-01-09 14:0309/01/202106:5509/01/202114:0306:5514:03
2021-01-11 00:002021-01-11 15:002021-01-11 22:2811/01/202115:0011/01/202122:2815:0022:58
2021-01-11 00:002021-01-11 22:452021-01-11 22:5811/01/202122:4511/01/202122:5815:0022:58
2021-01-12 00:002021-01-12 23:092021-01-13 00:0912/01/202123:0913/01/202100:0923:0907:06

 

2 ACCEPTED SOLUTIONS

Hi, @mayans 

In Power BI Table visual, only one record of the same data is displayed, so it is recommended to add index column (unique column) in PQ, and then add the index  to the column of the table in report view.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

Hi,  @mayans 

I make a sample file for reference.

Hope it could help you.

88.png

89.png

Best Regards,
Community Support Team _ Eason

 

 

View solution in original post

7 REPLIES 7
negi007
Community Champion
Community Champion

@mayans You can use the if formula in powerbi measure. Syntext would be little different from the excel. As in excel you specify the range but in powerbi you have to mention the column that you are using in your formula. In your case, you can first create a measure which can have pre-determined value like below

 

Parameter_Time = TIMEVALUE("01:30")
 
then you can change the format for the measure as below and use this measure in your second measure where you are using if condition. 

 

negi007_0-1613825792539.png

 

let me know if you are able to achive the desired output. else you can always write back with your pbix file to help you better. cheers!!!

 




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



Proud to be a Super User!


Follow me on linkedin

@negi007 how do i achieve A1-A2 in pbi? meaning the value of row 1 - the value of row 2 of the same column?

Hi,  @mayans 

I make a sample file for reference.

Hope it could help you.

88.png

89.png

Best Regards,
Community Support Team _ Eason

 

 

Hi, @mayans 

In Power BI Table visual, only one record of the same data is displayed, so it is recommended to add index column (unique column) in PQ, and then add the index  to the column of the table in report view.

 

Best Regards,
Community Support Team _ Eason

The solution was to add an index and use it to access other rows in this format. {[Index]}[columnName]

selimovd
Super User
Super User

Basically if you have the same table you can add the formula as a calculated column.

Did you try that?

just copy the formula from excel?

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.