Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Solved! Go to Solution.
Hi @IvayloKanov
To get your expected result, you can use Power Query only. First filter SortID column, then replace values in it. These are basic operations that can be done with the User Interface in Power Query Editor. You will then see the auto generated M code of a step in the formula bar. You can also open Advanced Editor in Home ribbon to see the complete M code of the whole query.
Power Query Reference:
Filter by values in a column - Power Query | Microsoft Docs
Replace values and errors - Power Query | Microsoft Docs
If you want to do this with DAX, after getting the filtered table, you can add a new column to have the new values as DAX doesn't have replace feature. Then select the columns you want to return.
Table 2 =
var filteredTable = FILTER('Table','Table'[SortID] in {"070i", "080i"})
var replacedTable = ADDCOLUMNS(filteredTable,"new_ID",IF('Table'[SortID]="070i","330i",'Table'[SortID]))
var newTable = SELECTCOLUMNS(replacedTable,"SortID",[new_ID],"Value",[Value])
return
newTable
DAX funtions:
ADDCOLUMNS function (DAX) - DAX | Microsoft Docs
SELECTCOLUMNS function (DAX) - DAX | Microsoft Docs
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @IvayloKanov
To get your expected result, you can use Power Query only. First filter SortID column, then replace values in it. These are basic operations that can be done with the User Interface in Power Query Editor. You will then see the auto generated M code of a step in the formula bar. You can also open Advanced Editor in Home ribbon to see the complete M code of the whole query.
Power Query Reference:
Filter by values in a column - Power Query | Microsoft Docs
Replace values and errors - Power Query | Microsoft Docs
If you want to do this with DAX, after getting the filtered table, you can add a new column to have the new values as DAX doesn't have replace feature. Then select the columns you want to return.
Table 2 =
var filteredTable = FILTER('Table','Table'[SortID] in {"070i", "080i"})
var replacedTable = ADDCOLUMNS(filteredTable,"new_ID",IF('Table'[SortID]="070i","330i",'Table'[SortID]))
var newTable = SELECTCOLUMNS(replacedTable,"SortID",[new_ID],"Value",[Value])
return
newTable
DAX funtions:
ADDCOLUMNS function (DAX) - DAX | Microsoft Docs
SELECTCOLUMNS function (DAX) - DAX | Microsoft Docs
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @IvayloKanov ,
You're mixing up two different languages here.
This part is DAX:
_myMeasure =
VAR __myVar = something
RETURN
__myVar
This part is M:
Table.ReplaceValue(arg1, arg2, arg3, arg4, arg5)
I appreciate your ambition, but you should get acquainted with the absolute basics first. Try these to get you going:
DAX:
Power Query/M:
https://docs.microsoft.com/en-us/powerquery-m/quick-tour-of-the-power-query-m-formula-language
https://radacad.com/basics-of-m-power-query-formula-language
Pete
Proud to be a Datanaut!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 9 | |
| 8 | |
| 7 | |
| 7 |