cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Antiparras Regular Visitor
Regular Visitor

Auto import and auto format data from a text file

Hi,

 

I have a log table in a SQL database that keeps only the latest 7 days. I want to store all the data in PBI model, so I can check further than 7 days.

 

I auto-generate a text file from a SQL table using the following command:

 

sqlcmd -U xxxxxxx -P xxxxxxxxx -S Server -d DBase-W -s ; -k -Q "SELECT * FROM Table" >> "C:\Log.txt"

 

When using the file as source I need to do some "tunning" to get the format correctly (promote headers, change date type, remove duplicates, filter out some rows, etc.) but as soon the file is updated using the command above, it seems to me you have to manually repeat all those steps again?

Does anybody can help me automating the data format (like a macro) so I can leave it unattended?

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
v-jiascu-msft Super Contributor
Super Contributor

Re: Auto import and auto format data from a text file

Hi Javi,

 

Yes, all the steps will be applied if your file only has new data without any other changes like new names, new structure.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-jiascu-msft Super Contributor
Super Contributor

Re: Auto import and auto format data from a text file

Hi @Antiparras,

 

Did you try the Refresh button? If there are no changes on the structure and names of the file "log.txt", you can refresh to get the latest data.

Screen_Capture_1_18_2018_15_25_14

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Antiparras Regular Visitor
Regular Visitor

Re: Auto import and auto format data from a text file

Hi @v-jiascu-msft,

 

Thank you for your reply. I'm aware of the refresh button and I might not explained myself properly. 

 

I want to be able to schedule (every 20 minutes) the data refresh and also apply the steps (data tuning, cleaning, etc) that I did in PBI Desktop, but without having to open it or request any "human interaction".

 

Using the "Schedule Refresh" I get the first part: refreshing the data. What I'm not certain is: Will the steps I made in the Query Editor be applied to the newest data too?

 

Regards,

Javi

v-jiascu-msft Super Contributor
Super Contributor

Re: Auto import and auto format data from a text file

Hi Javi,

 

Yes, all the steps will be applied if your file only has new data without any other changes like new names, new structure.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 142 members 1,686 guests
Please welcome our newest community members: