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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
coyote_ptm
Frequent Visitor

Keep Old Values

I have a requirement that I don't seem to understand how to do.

 

I have a table exported from an external software package ( it's exported to csv and picked up for refresh ) that contains:

employee_id INT,    -- unique employee ID

chg_pct INT                 -- number between 0 and 100

 

The current system does not track changes when the ratio changes.  To retain history, I'd like to save this data in PBI as:

employee_id,

chg_pct ,

changed_date

 

Look at exported employee_id, chg_pct, check to see if the chg_pct is different than the latest row and insert a new one if it is.

 

Is this possible?

 

 

1 ACCEPTED SOLUTION

Hi @coyote_ptm ,

 

Firstly, the same question as Ashish_Mathur mentioned, what does your table looks like?

Empl PCT
1 50
2 55
3 60

Or

Empl PCT Last Changed
1 50 2/1/2021
2 55 3/1/2021
3 60 4/1/2021

I think you need [Last Changed] column to determind the last changed date of data for each employee. 

You want to add a new row if some employee's PCT is changed instead of replacing. However refresh will replace the old value by new value. So I think refresh is not suitable. Here I suggest you to load the new data , use Append function and remove the duplicates.

For reference: Append queries

1.png

Select columns, right click and remove duplicates. Result is as below.

2.png

 

Best Regards,
Rico Zhou

 

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

4 REPLIES 4
parry2k
Super User
Super User

@coyote_ptm not very clear what you are looking for. Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I'd like to retain old values for a key value.

 

The original dataset example is a CSV that contains employee ID and percentage.  The data is exported to the CSV nightly.

EmplPCT
150
255
360

 

The table I'd like in PBI is Employee ID, percentage, Last changed date.  Example

EmplPCTLast Changed
1502/1/2021
2553/1/2021
3604/1/2021

 

I would like PowerBI to import changed values as new rows.  For example, employee 1 percentage was changed to 75 on 01/10/2022.  The refreshed data would still have the original data, but a new row for when the row was changed.  If employee 1 percentage changed to 75 on 01/10/2022.  The CSV that is export would only have 1 row still for empl with a new PCT:

EmplPCT
175
255
360

 

But the new table should be:

EmplPCTLast Changed
1752/1/2021
2553/1/2021
3604/1/2021
1751/10/2022

 

Hi @coyote_ptm ,

 

Firstly, the same question as Ashish_Mathur mentioned, what does your table looks like?

Empl PCT
1 50
2 55
3 60

Or

Empl PCT Last Changed
1 50 2/1/2021
2 55 3/1/2021
3 60 4/1/2021

I think you need [Last Changed] column to determind the last changed date of data for each employee. 

You want to add a new row if some employee's PCT is changed instead of replacing. However refresh will replace the old value by new value. So I think refresh is not suitable. Here I suggest you to load the new data , use Append function and remove the duplicates.

For reference: Append queries

1.png

Select columns, right click and remove duplicates. Result is as below.

2.png

 

Best Regards,
Rico Zhou

 

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

Hi,

From where will the dates appearing under the Last changed column appear.  In the first and the third table, there is no Date field at all?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.