Forum Discussion

matsahiro's avatar
matsahiro
Icon for Helper II rankHelper II
5 years ago
Solved

How to Dynamically Enter Date for Subset of Data each Data Refresh

Hello, I have a data set that will increase in size bi-annually, combining historical and current records. Each record has a field stating the date on which that data was pulled from the database, th...
  • edhans's avatar
    5 years ago

    You cannot do directly what you are asking here matsahiro. When Excel processes a macro based on how I am understanding what youa re going, it is entering a fixed amount based on that formula and it will not change. In other words, it is keying the correct date for you over the dataset for all new data, correct?

     

    In Power BI, any formula in a custom column is recalculated  each time the query is refreshed and runs over the entire dataset - it effectively deletes all data in the model then fully reloads it again. If you need the data timestamped it will have to be done at the source.

     

    If that is not correct, please clarify exactly what is happening and what you expect to happen. If you just want a date based on a date in your table, you can use the formula mahoneypat provided, or you can replace his [SaleDate] with DateTime.Date(DateTime.LocalNow()) which is Power Query's version of Today(). But again, it will do it on the entire data set. It will not leave yesterday's data untouched. Power BI isn't built to modify and incrementally add and modify records. It does it on the entire dataset.

     

    If you need it processed the way you want, I would suggest a few alternatives:

    1. Power Automate could to it for you depending on the dataset. If it is in an Excel file, it would need to be formatted a particular way for that table.
    2. Power Apps could also do it.
    3. Continue running your Excel macro daily (or whenever) to modify the data before Power BI reads it in.