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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ROCKYDO12
Helper III
Helper III

Data Load and coding

Hello,

 

I am looking for some guideance on creating some code to load into my Power BI Data Set. I am trying to write some code simular to how I used it in Qlik. Basically I have two data folders. The first is my base data (old/historical) and this data set never changes. The second is my new data set and this gets updated weekly with new records and changed records.

 

How I want it to work is to load the old CSV data file and load in the CSV new. The new file will load in new/changed records and replace that with the data being loaded in from the old. This is based on the Gift system ID field, so anytime a Gift system ID has new/changed records in the new data file, it should delete all these rows based on Gift system ID in the old and replace them with the new data. This process is needed to avoid duplications.

 

In my example below I have added two data sources for example. The first being the old and the second being the new. As you can see there is changed data for the new data file (*** indicating change). I need the old data to be deleted and the new data to populate my data set.

 

I have also attached the code I am using in Qlik. If there is an easier way to do this please let me know. I am open to any options.

 

https://drive.google.com/drive/folders/13TJBe80sM88x1FmMhZURbN9Ivmn47diR?usp=sharing

 

 

Old     
Gift System IDAppeal IDCampain IDFund IDPackage IDAmount
11111200
12111250
13111100
14111100
15111300
2111150
2211120
21111100
      
      
New     
Gift System IDAppeal IDCampain IDFund IDPackage IDAmount
11111200
12111250
131***21100
14111100
15111***10000
3 ACCEPTED SOLUTIONS

You can deduplicate in Power Query, just make sure to wrap your sorted table that puts the most recent results on top within a Table.Buffer, as explained here:

https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

View solution in original post

If you want to partition historical vs. new then you'll want to create two dataflows, it's more efficient than trying to do it all within the dataset. Just to the append/dedupe logic in the dataset (or you could do it in a third dataflow if you don't mind paying for Power BI Premium per User).

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

View solution in original post

Just create two dataflows by folder (historical and new), you don't need to create one for each file (that wouldn't scale at all!). Yes, once you load them in the dataset you can add filtering there if needed.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

View solution in original post

12 REPLIES 12
otravers
Community Champion
Community Champion

No, you can create dataflows with Power BI Pro too, with somewhat limited capabilities:

https://docs.microsoft.com/en-us/power-bi/transform-model/dataflows/dataflows-premium-features?tabs=...

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals
otravers
Community Champion
Community Champion

Load your data via two dataflows, one for historical data and another for fresh data. Only set the fresh one on a refresh schedule. Then load and append these dataflows into your dataset.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Okay so best advice I've gotten so far to carry out what I'm trying to do. Last thing though... so I don't apply a refresh on old data flow and then apply refresh policy for new! Then combine and append. But how would this solve my duplicate issue? I want to delete old and add new/changed from new file.

You can deduplicate in Power Query, just make sure to wrap your sorted table that puts the most recent results on top within a Table.Buffer, as explained here:

https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Do I need to create a data flow? Or can I just create a data set?

If you want to partition historical vs. new then you'll want to create two dataflows, it's more efficient than trying to do it all within the dataset. Just to the append/dedupe logic in the dataset (or you could do it in a third dataflow if you don't mind paying for Power BI Premium per User).

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

With my shared folders I have two seperate shared folders, one new and one historical. Within each folders I have about 10 data sets that have a one to one relationship between folders. Each CSV files are competly different but I can create a relationship when I create tables in my data set. I am just wondering do I need to create a data flow for each one of these CSV files within the folder? Or can I simply create two data flows, all files in historical and another for all files in new. Then when I bring my data flow into Power BI desktop to create my reports I can select what files I want from the data flows?  

Just create two dataflows by folder (historical and new), you don't need to create one for each file (that wouldn't scale at all!). Yes, once you load them in the dataset you can add filtering there if needed.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

In the data flow it is showing my 10 folders as one table. I know in my dataset in power BI I can filter and create querys and then combine from there but is there a way where I can left join everything in my data flow?

Thank you! Last question lol. Once I create the two day flows what would be the best option. Create multiple tables? Or is there a way I can just create 1 table and left merge everything based on one main table? Is that even a capability? If so please share a link or something that I can use.

Could you share high level over view of how this would work for my data set up above? Really appreciate as I am use to basic level datasets and not to this level.

Do I need premium license  to create data flows? 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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