Forum Discussion

Andrea78m's avatar
Andrea78m
Frequent Visitor
8 years ago
Solved

Listing data by date

Hi, when I connect a SQL server into Power BI, the date field(set as yyymmdd, es 20180102) becomes a SUM.

 

Pls can you help me?

How can I change it and to have it like a date, and not like a sum of numbers?

 

 

 

  • Hi Andrea78m,

     

    Add a new calculated column.

    Column2 =
    LEFT ( Table2[Column1], 4 ) & "/"
        & RIGHT ( LEFT ( Table2[Column1], 6 ), 2 )
        & "/"
        & RIGHT ( Table2[Column1], 2 )

     

    Best regards,

    Yuliana Gu

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Andrea78m,

     

    I think the date values which is formatted as "20180102" is recognized as whole number. The highlighted symbol ponits that the data type is number. So, please change the data type to "Date" in the ribbon.

     

    Best regards,

    Yuliana Gu

    • Andrea78m's avatar
      Andrea78m
      Frequent Visitor

       

      Unfortunately it gives me error

      Maybe I'd modify the query in power BI?

      Do you habe others idea to solve it?

      • v-yulgu-msft's avatar
        v-yulgu-msft
        Microsoft Employee

        Hi Andrea78m,

         

        Add a new calculated column.

        Column2 =
        LEFT ( Table2[Column1], 4 ) & "/"
            & RIGHT ( LEFT ( Table2[Column1], 6 ), 2 )
            & "/"
            & RIGHT ( Table2[Column1], 2 )

         

        Best regards,

        Yuliana Gu