cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
tomislav Frequent Visitor
Frequent Visitor

Lookup based on start and end date/time

HI, 

I have one table containing rules for conversion of local date/time to UTC time zone format. What I want to do is to convert local times in second table (from known time zone) into UTC time zone format, using rules of first table. Please advice how to do this in PQ? I tried creating  List of all dates/times (yyyy/mm/dd hh:mm:ss AM/PM format) within ranges (rules table), and then do the merge, but such method takes too long. Thanks

Tables 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Lookup based on start and end date/time

Hi @tomislav ,

 

We can achieve that by DAX.

Column = 
VAR a =
    - CALCULATE (
        MAX ( RULES[OffsetFromUTC_ForLocalTime] ),
        FILTER (
            RULES,
            RULES[EndOfTimeZoneOffset] >= 'TABLE TO CONVERT'[CreatedDate]
                && RULES[StartOfTimeZoneOffset] <= 'TABLE TO CONVERT'[CreatedDate]
        )
    )
RETURN
    'TABLE TO CONVERT'[CreatedDate] + TIME ( a, 0, 0 )

Capture.PNG

 

 

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

Re: Lookup based on start and end date/time

Hi @tomislav ,

 

We can achieve that by DAX.

Column = 
VAR a =
    - CALCULATE (
        MAX ( RULES[OffsetFromUTC_ForLocalTime] ),
        FILTER (
            RULES,
            RULES[EndOfTimeZoneOffset] >= 'TABLE TO CONVERT'[CreatedDate]
                && RULES[StartOfTimeZoneOffset] <= 'TABLE TO CONVERT'[CreatedDate]
        )
    )
RETURN
    'TABLE TO CONVERT'[CreatedDate] + TIME ( a, 0, 0 )

Capture.PNG

 

 

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

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Top Kudoed Authors
Users Online
Currently online: 349 members 2,944 guests
Please welcome our newest community members: