Skip Navigation Links.
🏠Home
Collapse 💻Apps💻Apps
Collapse 📂Topics📂Topics
Collapse 📹Video Tutorials📹Video Tutorials
🎬SQL: Pivot and Unpivot Dat...
🎬Power BI: Creating Busines...
🎬Analysing Data in SQL Serv...
🎬Time Intelligence in Power...
🎬SQL Magic: Auto-Generating...
🎬Using Gemini for SQL Data ...
🎬Using Dropdown Lists Effec...
🎬Build a Stunning Animated ...
🎬Power BI: Creating and Int...
🎬Advanced Power BI Realtime...
🎬Real time Monitoring with ...
🎬Creating and Using Flow Ma...
🎬How to create terrain, add...
🎬Game Design Tutorial for B...
🎬Dashboard with Relational ...
🎬Power Pivot and Data Model...
🎬Selecting Project using Pr...
🎬Two Ways to Use Custom SQL...
🎬Diversity, Equity, and Inc...
🎬Complete Guide to Using Dr...
🎬Gantt Chart in Power BI: C...
🎬Monitoring Progress Using ...
🎬Creating a Dashboard of Sa...
🎬Indigeno Technologies - Pa...
🎬Creating and Publishing We...
🎬Make Your Data Grow: Tree ...
🎬Power BI: Adding Historica...
🎬We asked an AI to create a...
🎬Power BI: Staff Engagement...
🎬Using Unicode Symbols in E...
🎬Power BI: Timesheet Analys...
🎬Time Machine for Your Data...
🎬Azure Data Studio - Comple...
🎬Power BI: Creating a Stunn...
🎬Power BI: Project Payback,...
🎬Power BI: Complete Realtim...
🎬Power BI: DAX Query View f...
🎬Build Your Own Excel Toolb...
🎬Data Science Programming: ...
🎬Power BI: Manage and Track...
🎬MS Excel: Using Images in ...
🎬MS Excel: Complete Guide t...
🎬Power BI: Creating Dashboa...
🎬Power BI: Using Latest Pre...
🎬Power BI: Performing Compa...
🎬Power BI: Creating Dashboa...
🎬Python: Forecasting with S...
🎬Power BI: Creating a Dice ...
🎬MS Excel: Creating a Dynam...
🎬Power BI: Create stunningl...
🎬MS Excel: Data Visualizati...
🎬Power BI: Assets Managemen...
🎬Power BI: Using Copilot in...
🎬Power BI: How to Create a ...
🎬MS Excel: Complete Guide t...
🎬Power BI: Easily Pivoting ...
🎬Power BI: How to Create a ...
🎬MS Excel: Using Python Rea...
🎬MS Excel: Realtime/Live Da...
🎬Power BI: Creating Paginat...
🎬Power BI: Exploring PBI On...
🎬MS Excel: Mastering MS Exc...
🎬MS Excel: Performing Non-L...
🎬MS Excel: How to add lates...
🎬Power BI: Performing PESTL...
🎬Power BI: Creating an Exot...
🎬Python: Resizing and Conve...
🎬Power BI:The Clock - Episo...
🎬MS Power Point: The Clock ...
🎬Looker Studio: Setting up ...
🎬HTML: Complete Course for ...
🎬Power BI: Creating a Power...
🎬MS Excel: Best Way to Crea...
🎬Power BI: Setting up Repor...
🎬Power BI: Real-time Data R...
🎬MS Excel: Mastering Excel ...
🎬SQL: Creating Realtime Liv...
🎬SQL: SQL Server Reporting ...
🎬Power BI: Data Modeling an...
🎬MS Excel: Data Modeling an...
🎬Python: Mastering NumPy Li...
🎬Power BI: Automating Data ...
🎬Power BI: How to Build a P...
🎬Power BI: Displaying Realt...
🎬Power BI: Unlocking Insigh...
🎬Power BI: How to Create a ...
🎬Power BI: Comparing Variou...
🎬Power BI: Animate Your Vis...
🎬MS Excel: Using Formulas l...
🎬Power BI: Using Folders as...
🎬Power BI: Using Folders as...
🎬Python: Uploading Files Di...
🎬Power BI: Creating Stunnin...
🎬Power BI: Integrating Pict...
🎬Power BI: Crafting Dynamic...
🎬Power BI: Dealing with Err...
🎬Power BI: Creating Dynamic...
🎬MS Excel: Calculating, Com...
🎬Power BI: Exploratory Data...
🎬Power BI: Create an Intera...
🎬Python: Creating Polynomia...
🎬Looker Studio: Creating Dy...
🎬Google Charts: Using Googl...
🎬Looker Studio: Understandi...
🎬Python: Mastering Data Vis...
🎬Power BI: Realtime Simulat...
🎬Power BI: Connecting to an...
🎬Python: Performing basic S...
🎬MS Excel: Simplifying Comp...
🎬Power BI: How to Create Hi...
🎬MS Excel: How to Use Calcu...
🎬Power BI: Using Small Mult...
🎬Power BI: Performing Finan...
🎬Power BI: Displaying SQL D...
🎬Power BI: Displaying Audit...
🎬Power BI: Loading Data int...
🎬Power BI: Using SQL Query ...
🎬Power BI: Visualizing Basi...
🎬MS Excel: Create a Smart, ...
🎬Power BI: Realtime Plant S...
🎬Power BI: Analyzing Season...
🎬Power BI: Creating your fi...
🎬Power BI: Creating Paginat...
🎬Power BI: Creating a Key P...
🎬Power BI: Creating Data So...
🎬Power BI: Setting up Power...
🎬Creating and Setting up a ...
🎬Power BI: Creating Pareto ...
🎬Power BI: Realtime Call Ce...
🎬Power BI: Creating a Proje...
🎬Power BI: Displaying Live ...
🎬Power BI: Using Conditiona...
🎬MS Excel: How to Create Re...
🎬Power BI: Realtime Sales S...
🎬Power BI: Displaying Realt...
🎬MS Excel: Using Excel Slic...
🎬Tableau: Tutorial for Begi...
🎬Power BI: How to Use Bookm...
🎬MS Access: How to Create R...
🎬MS Excel: Using What If An...
🎬Power BI: Create a YouTube...
🎬Power BI: Correlation Anal...
🎬Power BI: Analyzing Murder...
🎬Power BI: Manage and Monit...
🎬MS Excel: Creating an Anim...
🎬MS Excel: Creating 3D Maps...
🎬Power BI: Analyzing Wareho...
🎬MS Excel: How to add seria...
🎬Power BI: Mastering Market...
🎬MS Excel: What lies beneat...
🎬MS Excel/Power BI: Unpivot...
🎬Power BI: Exploring Defaul...
🎬MS Excel: Using the Break-...
🎬MS Excel: Predicting Sales...
🎬Power BI: Market Basket An...
🎬MS Excel: Creating a Bell ...
🎬Power BI: Creating a Dimen...
🎬Looker Studio: Creating a ...
🎬R: Creating Your First Pie...
🎬MS Excel: Conditional Form...
🎬Power BI: Analyzing human ...
🎬Python: Unleashing the Pow...
🎬Excel: Mapping, Grouping a...
🎬Power BI: Forecasting Data...
🎬Power BI: Grouping Data in...
🎬JavaScript: Using the if-e...
🎬Power BI: Connecting to th...
🎬JavaScript: Performing Mat...
🎬Power BI: Analyzing Bank L...
🎬MS Excel: Pivot... Pivot.....
🎬JavaScript: How to use onC...
🎬Power BI: Using Sankey Dia...
🎬Power BI: Multi Page Power...
🎬JavaScript: How to use onL...
🎬JavaScript: How to get the...
🎬Power BI: Crimes in Los An...
🎬Power BI: Crimes in Los An...
🎬Excel: Using the Fill Feat...
🎬Power BI: Drill-through Re...
🎬Power BI: Using DAX (Data ...
🎬Power BI: Using Smart Narr...
🎬Power BI: Bank Failure in ...
🎬Python: Predicting absente...
🎬Power BI: Dashboards with ...
🎬Power BI: Team and Product...
🎬Excel: Lookup Functions, V...
🎬Power BI: Artificial Intel...
🎬Power BI: Drill Down Repor...
🎬Python: Creating a GUI bas...
🎬Power BI: Visualizing Stoc...
🎬Python: Expected Returns (...
🎬Power BI: Decomposition Tr...
🎬Power BI: Sales and Profit...
🎬Python: Why you should not...
🎬Python: How to save, reloa...
🎬Power BI: Dimensional Mode...
🎬Python: How to classify da...
🎬Python: Machine Learning, ...
🎬Python: Web Scraping using...
🎬Animate: Classic Tween in ...
🎬Python: Support Vector Mac...
🎬Python: How to perform loo...
🎬Unity3d: How to create ter...
🎬Python: How to create and ...
🎬Python: How to work with a...
🎬Python: How to work with p...
🎬Python: How to work with S...
🎬SQL: How to create databas...
🎬Python: Data Scraping from...
🎬MS Excel: Pivot Tables, Pi...
🎬Python: How to use World B...
🎬MS Excel: How to use COUPD...
🎬Power BI: How to install P...
🎬Python: Easiest way to dow...
🎬MS Excel: How to use AMORD...
🎬MS Excel: How to use ACCRI...
🎬Python: Calculating varian...
🎬MS Excel: How to calculate...
🎬Python: How to calculate a...
🎬MS Excel: How to calculate...
🎬Python: How to calculate a...
🎬MS Excel: How to calculate...
🎬Python: How to calculate a...
🎬MS Excel: How to calculate...

📄Using DAX to split columns and create parent categories

We often want to extract text from a column before a specific string.

For example, in the following data, some of the products have their product codes along with them.



We want to analyze this data without the product codes, aggregating data for products with multiple models. For example, for desktop computers, we want the sales value to be 17k (5000+45000+4000+3500). To do this, we need to remove the product model numbers from the product names. All model numbers are separated by “-“. We can take the string before “-“. However both find and search formulas will return error, as not all product names have “-” in them, such as keyboard, mouse, router etc.

Here we have used Fnd = find(“-“,Products[Product]) and Srh = Search(“-“,Products[Product]) and both resulted in an error, because not all the products in product column contain “-“.

Image

The solution to the problem is quite simple. We need to provide a value in the find or search formula, if the character we are searching for is not found. Following formulas will return “0”, if the “-” is not found in the product column.
Fnd = find(“-“,Products[Product],,0)
Srh = Search(“-“,Products[Product],,0)

However, we will use the len(Products[Product]) instead of “0” because we want to use this formula with left() formula. In that case either the number of character where “-” is found, is returned, or the length of the string is returned. Both formulas will generate the same result, therefore we will keep one of them.

Image

To properly use this formula with the left() formula, we need to make a small adjustment. The final formula looks like this.
Fnd = find(“-“,Products[Product],,len(Products[Product])+2)-2

If we do not remove two from the find(), the left() formula will end up getting “Desktop Computer – ” instead of “Desktop Computer”. And if we do not add 2 to the len() formula, the left() formula will get “Mou” instead of “Mouse”.

Here is the final output.

Image


Dataset: https://docs.google.com/spreadsheets/d/1Nr__pemMdWI5L7WxiGm1i-o2ZlA9o_kK7Ll8-X8pR3s/edit?usp=sharing

Power BI file:
https://drive.google.com/file/d/1t74XnNUvk21fjawMfCzPoV0Mypao6Bjn/view?usp=sharing

Relevant Video Tutorial:
https://youtu.be/AuIzhIxGlXg