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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Replace values in table with values from calculated table based on a condition

Dear all,

 

I'm dealing with store visitation data analysis.

 

The data is very simple - 3 columns: date, store number (8 in total), number of visitors in.

 

There are 2 data sources - Dataflow and DirectQuery. Due to the some "features" of data collection there is an error which results in inaccuracy in a Dataflow dataset, where only 6 stores have correct data. So 2 incorrect ones must be replaced with values from DirectQuery, and for me, as a newby, this is not a trivial task. It can't be solved with DAX or simple Data Transform, so I believe it can be done with Power Query M, but have no idea extept using Table.ReplaceValue.

 

My tables look as following - so lets say number of visitors for stores #3 and #8 must be replaced with values from same shape, but calculated table:

 

DataStore NumberVisitors
01/01/20211123123
01/01/20212123123
01/01/2021334234
01/01/20214324435
01/01/20215545634
01/01/20216435345
01/01/20217324234
01/01/20218123123

 

Thanks in advance!

 

Regards, Taras

4 REPLIES 4

Hi Taras1!

 

I don

 

To replace the values in the "Visitors" column for stores 3 and 8 in your dataset with values from another table, you will probably have to use "Table.ReplaceValue" function in Power Query. This function allows you to replace specific values in a table with new values based on a matching condition.

To use the "Table.ReplaceValue" function, you can follow these steps:

  1. In Power BI, open the dataset that contains the table you want to modify.

  2. In the Power Query editor, select the table that you want to modify.

  3. In the "Transform" tab, click the "Replace Values" button. This will open the "Replace Values" dialog box.

  4. In the "Replace Values" dialog box, select the column that contains the values you want to replace in the "Column" field.

  5. In the "Value to Find" field, enter the values that you want to replace. In your case, these would be the values in the "Visitors" column for stores 3 and 8.

  6. In the "Replacement Value" field, enter the new values that you want to use to replace the old values. In your case, these would be the values from the other table that you want to use to replace the incorrect values in the "Visitors" column.

  7. Click "OK" to apply the replacement.

After you have replaced the values in the "Visitors" column, you can use the modified table in your report just like any other table in the dataset. You can also use the Power Query editor to modify or remove the replacement if necessary.

Hope this helps you in some way...

Anonymous
Not applicable

Hi Roberts,

 

thanks for answering, but at step 4 I got stucked - there is just no dialog window, just 2 fields like "Find - Replace with", that's it. Maybe I do something wrong?

 

And re step 6 - are you sure that it will work with calculated table? It's not even shown in Query Editor mode in the list of tables.

 

replace values.png

Hi, i think you have to format the column as text first and then to number again.

Anonymous
Not applicable

Unfortunatelly it doesn't make sence, you still have the same interface with no selecting options (

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors