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
Lobs
Helper II
Helper II

Vlookup True equivalent in Power BI

Hi All, 

 

For some reason, this has always been a challenge for me and have been bothered about this ever since. Basically i am trying to group a column containing the time we get interactions and i am trying to group them based on a set of intervals list. 

 

Intervals - this would run until 11:30:59 PM

Lobs_0-1633272804901.png

 

And here is the column containing the time, that i would like to group based on the intervals shown above. 

Lobs_1-1633272856412.png

Basically, its the vlookup True equivalent in excel. I was able to come up with this but kept on getting an error that it does not support date types. 

 

Interval (i) =
VAR _Interaction =
    MAX ( NPS[Interaction Time (CST] )
VAR _Interval =
    MAXX (
        FILTER (
            Intervals,
            NPS[Interaction Time (CST] = _Interaction >= Intervals[From]
                && _Interaction <= Intervals[To]
        ),
        [Interaction Time (CST]
    )
RETURN
    _Interval

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You can use List.PositionOf to get XLOOKUP behavior in power query, but in your case it would be simpler to round your times to the nearest half hour with a formula like this.  You could use Number.RoundUp or down if needed too.

 

= Time.From(Number.Round(Number.From([TimeColumn])*24*2)/(24*2))

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Please share some data and share the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Employee
Employee

You can use List.PositionOf to get XLOOKUP behavior in power query, but in your case it would be simpler to round your times to the nearest half hour with a formula like this.  You could use Number.RoundUp or down if needed too.

 

= Time.From(Number.Round(Number.From([TimeColumn])*24*2)/(24*2))

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you, this worked perfectly and just need to round down. Appreciate it. 

 

Cheers

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.