Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

sql date format to bi

Hi

 

below  is the format  for date sql, can  I show this as date in period in power bi.or I can get only year and month in bi

 

Date Period
202002
202002
202002
202002
202002
  • Anonymous's avatar
    Anonymous
    5 years ago

    hi Anonymous - you can use calculated columns to do the same as seen in screen grabs below

     

    Year = FORMAT(LEFT(Date_Period[Date Period], 4), "YYYY")
    Month = FORMAT(MID(Date_Period[Date Period],5, 2), "MMM")
    Date = DATE(Date_Period[Year], Date_Period[Month], 1)

     

     

     

    Hardcoding the "Day" of each month as 1 to convert to a date field 

     

     

    Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    hi Anonymous - you can use calculated columns to do the same as seen in screen grabs below

     

    Year = FORMAT(LEFT(Date_Period[Date Period], 4), "YYYY")
    Month = FORMAT(MID(Date_Period[Date Period],5, 2), "MMM")
    Date = DATE(Date_Period[Year], Date_Period[Month], 1)

     

     

     

    Hardcoding the "Day" of each month as 1 to convert to a date field 

     

     

    Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!