Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Data type is wrong?

Hi guys! First of all Happy New Year.

 

I´m working on a report for my work which has a lot of projects with their respective last update on the database. I´m making a function that calculates the days since the last update. The problem is that I´m having negative numbers and inconsistencies.

 

The function for the Column " Days since Last Update" is: 

Days since Last Update = TODAY()-'TPA Portfolio'[Last Update Date]

 

It´s important to remark that the Last Update Date column is stated by PowerBI as a Text field and the format is DD/MM/YYYY (Argentinian date)

 

 

Thanks for your help...

  • Nowhere. It was just an example to illustrate the solution.

     

    In your case, go to the Query Editor, select your column with textual dates and adjust the data type using Locale.

     

    The video below illustrates how; it starts already in the Query Editor.

     

    Here is the Query Editor

     

     

     

8 Replies

  • Hi Anonymous,

     

    What about using the datediff function for this issue...

     

    Let us know

    • Anonymous's avatar
      Anonymous
      Not applicable

      Days since Last Update = DATEDIFF(TODAY(),'TPA Portfolio'[Last Update Date],DAY)

       

      And I´m getting: In DATEDIFF function, the start date cannot be greater than the end date

       

      I think the Power BI is messing between the date format of my PC (which is English format mm/dd/yyyy) and the format of the data base