Forum Discussion

askspepsi's avatar
askspepsi
Helper II
6 years ago
Solved

Extract AM / PM from Datetime format in direct query

hi all,

 

Greetings,

 

Is the way to Extract AM or PM from Datetime format in direct query without changing to Import storage.

Or is there any another way to create another table or colume to extract time and convert to AM / PM

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    askspepsi Should be able to use DAX to parse that using RIGHT, like maybe:

     

    Measure = RIGHT(MAX('Table'[Datetime]) & "",2)
    • askspepsi's avatar
      askspepsi
      Helper II

      Greg_Deckler  thanks for the update.

       

      iam really sorry i was not clear in the question i asked, let me rephrase again.

       

      i have column name with datetime (see the below) and create AM / PM when i select AM the 06:00 and 5:50 only and when i select PM i what 17:58 and 17:59 

      2020-07-23 17:58:57.000
      2020-07-23 17:59:02.000
      2020-07-23 06:00:37.000
      2020-07-23 05:50:25.000