How do Substitute and Trim functions work in power bi DAX

This recipe explains how do Substitute and Trim functions work in power bi DAX

Recipe Objective - How do SUBSTITUTE and TRIM functions work in Power BI DAX?

SUBSTITUTE - replaces existing text with new text in a text string.

TRIM - removes all spaces from text except for single spaces between words.

Build Expedia Hotel Recommendation System using Machine Learning

SUBSTITUTE

Write down the query as substitute = SUBSTITUTE("Joe is smart", "Joe", "Mario")

It will replace Joe with Mario in the given text and returns Mario is smart.

TRIM

Write down the query as trim = TRIM(" hello world")

It will replace all the unnecessary spaces from text and returns hello world.

In this way, we can use the SUBSTITUTE and TRIM functions in Power BI.

What Users are saying..

profile image

Ed Godalle

Director Data Analytics at EY / EY Tech
linkedin profile url

I am the Director of Data Analytics with over 10+ years of IT experience. I have a background in SQL, Python, and Big Data working with Accenture, IBM, and Infosys. I am looking to enhance my skills... Read More

Relevant Projects

Build Customer Propensity to Purchase Model in Python
In this machine learning project, you will learn to build a machine learning model to estimate customer propensity to purchase.

Build a Customer Churn Prediction Model using Decision Trees
Develop a customer churn prediction model using decision tree machine learning algorithms and data science on streaming service data.

Time Series Analysis with Facebook Prophet Python and Cesium
Time Series Analysis Project - Use the Facebook Prophet and Cesium Open Source Library for Time Series Forecasting in Python

Build CNN for Image Colorization using Deep Transfer Learning
Image Processing Project -Train a model for colorization to make grayscale images colorful using convolutional autoencoders.

Deep Learning Project for Beginners with Source Code Part 1
Learn to implement deep neural networks in Python .

Time Series Forecasting Project-Building ARIMA Model in Python
Build a time series ARIMA model in Python to forecast the use of arrival rate density to support staffing decisions at call centres.

Deep Learning Project- Real-Time Fruit Detection using YOLOv4
In this deep learning project, you will learn to build an accurate, fast, and reliable real-time fruit detection system using the YOLOv4 object detection model for robotic harvesting platforms.

Word2Vec and FastText Word Embedding with Gensim in Python
In this NLP Project, you will learn how to use the popular topic modelling library Gensim for implementing two state-of-the-art word embedding methods Word2Vec and FastText models.

ML Model Deployment on AWS for Customer Churn Prediction
MLOps Project-Deploy Machine Learning Model to Production Python on AWS for Customer Churn Prediction

A/B Testing Approach for Comparing Performance of ML Models
The objective of this project is to compare the performance of BERT and DistilBERT models for building an efficient Question and Answering system. Using A/B testing approach, we explore the effectiveness and efficiency of both models and determine which one is better suited for Q&A tasks.