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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
allenind
Frequent Visitor

Dynamically adding data rows to dataset based on a condition

I am trying to modify my table1 to be able to dynamically add rows to the dataset based on the condition if one "Application Name" is not found in table1 but is present in Table 2, I will add the application name, make the version column to have the default value of 0.0 and just copy the computer name  from table2 to table 1. My tables look like this:

 

Table 1:

 

APPLICATION NAMEVERSIONCOMPUTERNAME
Adobe Acrobat Reader DC19.010.20069COMPUTER1
Google Chrome87.0.4280.141COMPUTER1
Microsoft Edge87.0.664.75COMPUTER1
SnagIt12.4.0COMPUTER1
Adobe Acrobat Reader DC18.010.20069COMPUTER2
Google Chrome85.0.4280.141COMPUTER2
Microsoft Edge84.0.664.75COMPUTER2
SnagIt11.4.0COMPUTER2

 

Table 2:

 

APPLICATION NAMEVERSION
Adobe Acrobat Reader DC19.010.20069
Google Chrome87.0.4280.141
Microsoft Edge87.0.664.75
SnagIt12.4.0
Microsoft Visual Studio10.0
Python Launcher3.82

 

Expected Outcome:

NEW TABLE 1

APPLICATION NAMEVERSIONCOMPUTERNAME
Adobe Acrobat Reader DC19.010.20069COMPUTER1
Google Chrome87.0.4280.141COMPUTER1
Microsoft Edge87.0.664.75COMPUTER1
SnagIt12.4.0COMPUTER1
Microsoft Visual Studio0.0COMPUTER1
Python Launcher0.0COMPUTER1
Adobe Acrobat Reader DC18.010.20069COMPUTER2
Google Chrome85.0.4280.141COMPUTER2
Microsoft Edge84.0.664.75COMPUTER2
SnagIt11.4.0COMPUTER2
Microsoft Visual Studio0.0COMPUTER2
Python Launcher0.0COMPUTER2

 

*note that the version of the newly added rows are 0.0 because I have a DAX column that will check if it is 0.0 it means the software is not installed in computer1, computer2 and so forth. 

 

Any help would be greatly appreciated, thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @allenind 

You can achieve your goal by power query or Dax.

My Sample Table is the same as yours.

DAX:

You can build a new calculated table.

 

 

New Table1 Dax = 
VAR _AppNameonlyinTable2 = SUMMARIZE(FILTER('Table 2',NOT('Table 2'[APPLICATION NAME] in VALUES('Table 1'[APPLICATION NAME]))),'Table 2'[APPLICATION NAME])
VAR _COMPUTERNAME = VALUES('Table 1'[COMPUTERNAME])
VAR _TRANSFORM = GENERATE(ADDCOLUMNS(_AppNameonlyinTable2,"VERSION","0.0"),_COMPUTERNAME)
VAR _NEW_TBALE1 = UNION('Table 1',_TRANSFORM)
RETURN
_NEW_TBALE1

 

 

Result is as below.

1.png

Power Query:

Merge Table2 and Table1 as a new table, select left Anti.

2.png

Then remove all column except APPLICATION NAME in new table.

Add a custom column "Version" = "0.0" in new table. (Rename as New Table 1)

Then we duplicate table1, remove all columns except COMPUTERNAME, right click and remove duplicate values.

3.png

Add a custom column in New Table 1. Custom = #COMPUTERNAME

Expand Custom column and rename as COMPUTERNAME.

Finally Append Newtable1 with Table1.

Result is as below.

4.png

You can download the pbix file from this link: File

 

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

3 REPLIES 3
amitchandak
Super User
Super User

@allenind , One option is  Merge in power query, Right Join.

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak, I have tried this and my expected outcome does not happen, it merges my two queries but It is not robust enough to be able to set a value of 0.0 to the version and to also copy the computer name value.

Anonymous
Not applicable

Hi @allenind 

You can achieve your goal by power query or Dax.

My Sample Table is the same as yours.

DAX:

You can build a new calculated table.

 

 

New Table1 Dax = 
VAR _AppNameonlyinTable2 = SUMMARIZE(FILTER('Table 2',NOT('Table 2'[APPLICATION NAME] in VALUES('Table 1'[APPLICATION NAME]))),'Table 2'[APPLICATION NAME])
VAR _COMPUTERNAME = VALUES('Table 1'[COMPUTERNAME])
VAR _TRANSFORM = GENERATE(ADDCOLUMNS(_AppNameonlyinTable2,"VERSION","0.0"),_COMPUTERNAME)
VAR _NEW_TBALE1 = UNION('Table 1',_TRANSFORM)
RETURN
_NEW_TBALE1

 

 

Result is as below.

1.png

Power Query:

Merge Table2 and Table1 as a new table, select left Anti.

2.png

Then remove all column except APPLICATION NAME in new table.

Add a custom column "Version" = "0.0" in new table. (Rename as New Table 1)

Then we duplicate table1, remove all columns except COMPUTERNAME, right click and remove duplicate values.

3.png

Add a custom column in New Table 1. Custom = #COMPUTERNAME

Expand Custom column and rename as COMPUTERNAME.

Finally Append Newtable1 with Table1.

Result is as below.

4.png

You can download the pbix file from this link: File

 

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. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.