Forum Discussion

Sunil0741's avatar
Sunil0741
Regular Visitor
4 years ago

How to Convert date and time from PST to IST

I have a question in Power BI.

 

I am using an ODBC data source lnked directly to power BI, which has a column of date and time recorded in PST timezone.

Now I am looking to add a column in Power BI which shall have date and time converted from above said PST timezone to IST timezone.

 

For an example:

Column A has 07/05/2022 07:30:00 AM PST

I need In column B as 07/05/2022 08:00:00 PM IST

7 Replies

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi Sunil0741,

     

    No, for DirectQuery mode, considering the performance, complex calculations cannot be used. This is a limitation of directquery.

    You can try Import mode for ODBC.

     

    Or, you can try the something like the following screenshot.

     

     

    IST = SELECTEDVALUE(datetime_table[datetime]) + TIME(12,30,0)
     

    Best Regards

    Community Support Team _ chenwu zhu

     

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

    • Sunil0741's avatar
      Sunil0741
      Regular Visitor

      Hi v-chenwuz-msft 

       

      Thank you. I tried adding 12 hours 30 minutes but it vary during daylight saving as 13 hours 30 minutes.

       

      That is where I am looking to convert date and time considering daylight saving.

       

      • v-chenwuz-msft's avatar
        v-chenwuz-msft
        Icon for Community Support rankCommunity Support

        Hi Sunil0741 ,

         

        Or try use IF statement to identify date?

        Like this:

        ist =
        VAR _selecteddate =
            SELECTEDVALUE ( datetime_table[datetime] )
        VAR _selecteddateYear =
            YEAR ( _selecteddate )
        VAR _start =
            DATE ( _selecteddateYear, 3, 1 ) + 7
                - WEEKDAY ( DATE ( _selecteddateYear, 3, 1 ), 2 ) + 7
        VAR _end =
            DATE ( _selecteddateYear, 11, 1 ) + 7
                - WEEKDAY ( DATE ( _selecteddateYear, 11, 1 ), 2 )
        RETURN
            IF (
                _selecteddate >= _start
                    && _selecteddate <= _end,
                _selecteddate + TIME ( 13, 30, 0 ),
                _selecteddate + TIME ( 12, 30, 0 )
            )
        

        Result:

         

         

        Best Regards

        Community Support Team _ chenwu zhu

         

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

         

         

  • On the left, select the 'Power BI Analytics' tab.
    On this page, select the 'Settings' tab at the top right.
    On the page that appears, you'll see your current time zone listed. 
    A drop-down will appear where you can select a new time zone.
    Click 'Save'.

     

    Regards,
    J Wick

    • Sunil0741's avatar
      Sunil0741
      Regular Visitor

      I am using power bi desktop and I don't see On the left, select the 'Power BI Analytics' tab

       

      Thanks for your help.