Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NGI
Frequent Visitor

Identify new rows on the table and create a collumn with their load dates

Hello Guys. I really need your help on this. Maybe it's easy, but i am not getting it.

 

I have some txt files that I take from an open base in a website. So I keep thos files in the computer as my database. I use a scrip in Python to download everyday the new file, and it overwrites the old file.

 

So, I really need to know which ones are the new rows of the day and, for my purposes, I need to write the date that this new file was downloaded.

 

I am thinking in something like copying the table and compare, but I am not sure how to create this date. I've tried to use data.local.now and datelocalfixed, but they updated the value after a refresh, they did not keep.

Can you guys give me a hand? It would very aprecciated.

If I was not clear, please feel free to say it. 

 

Thanks in advance.

3 REPLIES 3
Nolock
Resident Rockstar
Resident Rockstar

Hi @NGI,

Power BI doesn't keep any historical changes. Every refresh replaces the whole internal database. It means you have to store all versions on your disk.

Can your Python script do that for you? Can the script create a new file every day instead of replacing it? Can a new file contain only data from the last day? Do your records have a timestamp or an ID?

If the file name contains a timestamp, you can parse a date from the file name. Or, but not recommended, you can also use file properties like date created or date modified when using the Folder data connector.

Many questions, I know, but it helps us to find a solution much faster.

NGI
Frequent Visitor

Hey @Nolock , Thanks for your reply. Here are the answers:

 

Can your Python script do that for you?

I think we can try something like this, but we were trying some solution in pwoer query.

Can the script create a new file every day instead of replacing it?

Yes, it can, but they are big files...

Can a new file contain only data from the last day?

Yes it can, but it would be too many files to keep...

Do your records have a timestamp or an ID?

No. The key is a three collumns combination.

 

Any other ideas using power query? Thanks again!

Nolock
Resident Rockstar
Resident Rockstar

Hi @NGI,

thanks for your answers.

I'd like to suggest 2 options:

  1. Your Python script creates a new file every day. This file has a proper name containing a date. You will have many files, but it isn't a problem to merge them all in PowerQuery. Use Folder Connector and merge all files together.
  2. You modify your Python script which adds newly a timestamp to every row when created. And you append new rows to an existing file. You have only one file and you know when a row was appended.

Which one do you prefer?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors