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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
RichOB
Post Partisan
Post Partisan

Measure/ DAX to filter column by text

Hi, in this example, I have the raw data in Table 1

 

I need to split up the Involvement column so I can add the Victim and Perpetrator as their own columns on the same row.

 

How can I achieve how table 2 looks, please?

 

Table1

Incident_Number Individual IDInvovlementCity Name Type
Inc1ID1PerpetratorLiverpoolDave.DAssuault
Inc1ID2VictimLiverpoolMark.MAssuault
Inc2ID3PerpetratorLiverpoolGrant.GAssuault
Inc2ID4VictimLiverpoolPaul.PAssuault
Inc3ID5PerpetratorLiverpoolAaron.AHarassment
Inc3ID6VictimLiverpoolThomas.THarassment


Table2

Incident_Number CityPerpetrator_NameVictim_NameType
Inc1LiverpoolDave.DMark.MAssault
Inc2LiverpoolGrant.GPaul.PAssault
Inc3LiverpoolAaron.AThomas.TOverdose


Thanks for your help

1 ACCEPTED SOLUTION

Hi @RichOB 

 

Before performing the Pivot Column step, just add one extra step to remove the nulls from the Involvement column:
Here's how:
  1. In Power Query, select the Involvement column
  2. Go to the top ribbon >> Filter >> Uncheck (null)
  3. Now try the Pivot Column step again (as before)
This will ensure Power Query only uses valid text entries ("Victim" / "Perpetrator") and avoids the type conversion error.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

4 REPLIES 4
rohit1991
Super User
Super User

Hi @RichOB 

 

Power Query Solution (No DAX Needed)
1. Load your Table1 into Power BI
2. Go to Transform Data (Power Query)
3. Select the Name column
4. Click on Transform >> Pivot Column
5. For the Values Column, choose "Name"
6. For the Pivot Column, choose "Involvement"
7. In the Advanced Options >> Use "Don't Aggregate" (if prompted)
8. Done! You’ll now see Victim and Perpetrator names as separate columns for each Incident_Number


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Hi, thanks for your reply. I tried it but it's giving me the error:

Expression.Error: We cannot convert the value null to type Text.
Details:
Value=
Type=[Type]

How can I rectify the null entries please?

Amazing, thanks for your help!

Hi @RichOB 

 

Before performing the Pivot Column step, just add one extra step to remove the nulls from the Involvement column:
Here's how:
  1. In Power Query, select the Involvement column
  2. Go to the top ribbon >> Filter >> Uncheck (null)
  3. Now try the Pivot Column step again (as before)
This will ensure Power Query only uses valid text entries ("Victim" / "Perpetrator") and avoids the type conversion error.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors