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
Omar1
Frequent Visitor

Adding Rows to a Table from Another Table

I'd like to create an Account Activity table that shows every activity from each account to it. Currently, I have an Account table where it shows only the latest activity. The Account table gets updated on a daily basis. Ideally, I'd like to add the latest account activity from the Account table to the Account Activity table as an individual row.

 

Example:

- Monday: Account #123 added 3 contacts

- Tuesday: Account #123 added 4 contacts

 

The Account table in the latest refresh would show the last activity as "added 4 contacts"....I'd like to have the Account Log table show both rows.

 

Is that possible in Power BI? If so, how?

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Nope, I guess with some R code this can be done but I don't think PowerBI is used to write back. You have to work on database end to take care of this.



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.

View solution in original post

10 REPLIES 10
v-juanli-msft
Community Support
Community Support

Hi
which is the relationship between Account Activity table and the Account table, does they have a key column such as account?
As you said, “The Account table in the latest refresh would show the last activity as "added 4 contacts"”, so the example of Monday and Tuesday should show in the rows of Account Activity table, right?
Whether we could add rows to a table from another table depends on the table structure. So, if it is convenient for you, please share me screenshots or files to know how the table structure.
I also confused by this sentence “I'd like to have the Account Log table show both rows”, does the Account Log table refer to the Account table above?
 
Best Regards
Maggie

Thank you for helping out, it's very kind of you!

 

The relationship between Account and Account Activity tables will be the AccountId.

 

example.PNG

 

In the example above, that's what my Account table will look like where the last column is FrienshipLevel.

 

The problem is that with this table above, the FriendshipLevel changes, but I would like to track each change for each account using Power BI.

 

For example, if I change Joe Smith's FriendshipLevel from 5 to 13 today....the LastModifiedDate will be today's date and I will lose what the FriendshipLevel was before.

 

That is where I was hoping the Account Acitivity Table comes in because it would show something like this...

examplep2.PNG

 

I guess you have two table account and account activity, bring both to the data model and set relationship on ID between tables.

 

You can see all the history of selected ID (employee) from your account table.



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.

Omar1
Frequent Visitor

Currently, I only have one table (below).example.PNG

 

 

I was wondering, can I use Power BI to create this table (below) from the data in the above table?

examplep2.PNG

 

I'm sorry for not making it clear.

 

 

Sorry man, not sure what you have and what not?

 

So you have account activity table but no account table or other way?



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.

Omar1
Frequent Visitor

I have the account table and don't have the account activity table.

 

I was hoping to create an account activity table from the data in the account table.

Not sure how that is even possible, if your data model doesn't have the data, I don't htink PowerBI can generate data. Think logically how PowerBI will now what was the previous friendshiplevel and when it was changed, may be I'm missing something here.



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.

Omar1
Frequent Visitor

You're absolutely right and I understand that part.

 

My assumption was that since the data refreshes on a daily basis in Power BI, there can be a validation that checks if the LastModifiedDate for an account in the Account table is greater than the ModifiedDate for the same account in the Account Activity table. If it's not, then it adds the account data from the Account table to the Account Activity table as a new row.

 

Is that possible in Power BI?

 

Nope, I guess with some R code this can be done but I don't think PowerBI is used to write back. You have to work on database end to take care of this.



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.

Omar1
Frequent Visitor

Thank you for letting me know. I appreciate your help!

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.