Forum Discussion
Update visual table column via CSV
I want to incorporate the values from the CSV file into the Key columns specified in the visual table.
I have created a CSV file named "BI-Del.csv". Upon clicking a button, I would like to read the contents of this CSV file and fill the "Key" field with the next available key.
CSV contents
| NumID | Key |
| 1 | QMS01ANN |
| 2 | QMS01ANM |
| 3 | QMS01ANQ |
| 4 | QMS01ANP |
| 5 | QMS01AMD |
| 6 | QMS01AMC |
| 7 | QMS01AMB |
| 8 | QMS01AMA |
| 9 | QMS01AM6 |
| 10 | QMS01ALU |
Current visual table view
| circuit1 | featureType | Key |
| MORTON_133 | Primary Fuse | |
| MONROE_006 | Transformer | |
| MORTON_133 | Transformer | |
| MONROE_006 | Primary Fuse | |
| MORTON_133 | Primary Fuse | |
| MONROE_006 | Transformer | |
| MORTON_133 | Transformer | |
Desired results (updated visual table view)
| circuit1 | featureType | Key |
| MORTON_133 | Primary Fuse | QMS01ANN |
| MONROE_006 | Transformer | QMS01ANM |
| MORTON_133 | Transformer | QMS01ANQ |
| MONROE_006 | Primary Fuse | QMS01ANP |
| MORTON_133 | Primary Fuse | QMS01AMD |
| MONROE_006 | Transformer | QMS01AMC |
| MORTON_133 | Transformer | QMS01AMB |
2 Replies
- tayloramySuper User
Hi jwb3d,
Can you elaborate more on the desired functionality?
I assume this is in a Power BI report?
If you want a button click to load data into a report, then you're looking at a translytical task flow.
Understand translytical task flows - Power BI | Microsoft LearnThis allows pressing the button to call a python UDF in Fabric, which can then load data.
Can you explain how your model is currently set up? Translytical task flows work best with DirectLaake models where the data is sitting in a warehouse.
Can you also explain where this CSV file is? Is it sitting in an on prem file share, is it in sharepoint, or is it in a lakehouse file section already?
- ShivekMaharajImpactful Individual
Hi jwb3d,
tayloramy's questions about the model and CSV location are important. I would add one other requirement before choosing the implementation: you need a stable way to match each CSV row to the underlying data row.
From the example, it looks like you want:
CSV NumID 1 -> first displayed row
CSV NumID 2 -> second displayed rowand so on.
I would avoid using the visual row position for that. A Power BI table is only a presentation of the model, and its ordering can change with filtering/sorting. You also have repeated circuit1 / featureType combinations, so I would add or use a unique RowID in the underlying table and match that to NumID.
If this needs to happen when the user clicks a button, then a Translytical Task Flow is a reasonable approach. The button calls a Fabric User Data Function, which updates the underlying Fabric SQL Database, Warehouse or Lakehouse data. The report then reflects the updated values.
I would think of it as:
Power BI button -> User Data Function -> read CSV -> match NumID to RowID -> update Key in sourcerather than updating the table visual directly.
One other consideration is where BI-Del.csv lives. If it is only a local file on the report user's PC, the Data Function button does not act as a general local-file upload control. I would first place/ingest the CSV somewhere the function can access, such as a Lakehouse file.
If the CSV is already available during normal dataset refresh and there is no real need for a button, then a Power Query merge using NumID/RowID would be much simpler.
So I would first clarify two things: where the CSV is stored, and what unique column identifies each target row.