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
Yacine_VC
Frequent Visitor

How to create a string column out of 3 other string columns

Hello everyone,

 

I'm having an issue with my PBI model : it's supposed to count the number of people attending to formations. The report is based on an excel file, filled by the trainers. It looks like that :

Training nameDateParticipant e-mailTool 1Tool 2Tool 3
Training 131/05/2024xxx@email.comTeamsSharePoint 
Training 131/05/2024xxx@email.comTeamsSharePoint 
Training 131/05/2024xxx@email.comTeamsSharePoint 
Training 226/04/2024xxx@email.comSharePoint  
Training 226/04/2024xxx@email.comSharePoint  
Training 226/04/2024xxx@email.comSharePoint  
Training 319/04/2024xxx@email.comTeamsPlannerTo Do
Training 319/04/2024xxx@email.comTeamsPlannerTo Do
Training 319/04/2024xxx@email.comTeamsPlannerTo Do

 

I created a measure to count the numer of times each tool appears in the three "tool" columns at the time.
Now to filter the measure above in a graphic, I would like to create a column (maybe in a new table?) listing each string appearing in the three "tool" columns at least once, and without any duplicate.
That would look like that :

Teams

SharePoint
Planner
To Do
OneDrive
Viva Engage

 

I haven't been able to generate such a column, I can only concatenate the three "tool" columns cells, but that's not what I'm looking for.

Would someone know how I could manage to create this column ?

 

Best regards.

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @Yacine_VC ,

 

First of all thanks to @Tahreem24  for the quick reply and solution. He did a great job solving your initial problem. I have some suggestions for your follow-up questions. If I have misunderstood you, please create a new case, we suggest a case to solve only one problem, because it can get good help and give a better reference for other users!

 

The recommendations are as follows:

(1)We can create a table.

Table 2 = FILTER(DISTINCT(UNION(
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 1]),
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 2]),
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 3]))
),[Tool]<>BLANK())

(2)We can create a measure.

Measure = COUNTROWS(FILTER(ALLSELECTED('Table'),[Tool 1] in VALUES('Table 2'[Tool]) || [Tool 2]in VALUES('Table 2'[Tool]) || [Tool 3] in VALUES('Table 2'[Tool])))

 (3) Then the result is as follows.

vtangjiemsft_0-1721271673786.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, select all columns other than the Tools columns, right click and select "Unpivot Other Columns".  You may remove the attribute column and rename the Value column to Tools.  Write this measure

Total = countrows(Data)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This worked very well, thanks a lot!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-tangjie-msft
Community Support
Community Support

Hi @Yacine_VC ,

 

First of all thanks to @Tahreem24  for the quick reply and solution. He did a great job solving your initial problem. I have some suggestions for your follow-up questions. If I have misunderstood you, please create a new case, we suggest a case to solve only one problem, because it can get good help and give a better reference for other users!

 

The recommendations are as follows:

(1)We can create a table.

Table 2 = FILTER(DISTINCT(UNION(
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 1]),
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 2]),
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 3]))
),[Tool]<>BLANK())

(2)We can create a measure.

Measure = COUNTROWS(FILTER(ALLSELECTED('Table'),[Tool 1] in VALUES('Table 2'[Tool]) || [Tool 2]in VALUES('Table 2'[Tool]) || [Tool 3] in VALUES('Table 2'[Tool])))

 (3) Then the result is as follows.

vtangjiemsft_0-1721271673786.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

Tahreem24
Super User
Super User

@Yacine_VC Try this new DAX Table,

Table 2 = DISTINCT(UNION(
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 1]),
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 2]),
    SELECTCOLUMNS('Table',"Tool", 'Table'[Tool 3]))
)

Tahreem24_0-1721060505921.png

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

It worked very well, thank you very much.

 

But it seems that it doesn't filter the tool names as I expected in my graphic :

graphique tool.png

 

I was expecting the graphic to display to filter the number of sessions attended throught the names of the tools of each session : 13 values for Planner, 56 values for Power BI, 12 values for Outlook, etc.

 

The X axis is filled with the tool list I created with your help, while the Y axis is filled with a measure accounting the number of rows where each tool name appears.

The measure code is this one : 

Nb spectateurs par outil = COUNTROWS(
    FILTER(Liste_sessions,NOT(ISBLANK(Liste_sessions[Outil 1])) || NOT(ISBLANK(Liste_sessions[Outil 2]) || NOT(ISBLANK(Liste_sessions[Outil 3])))))
 
So I'm wondering if the problem doesn't come from my data model : I can create a relationship between the column listing all tools and only one of the tool columns from my session list table.
Report Model.png

 

Would you know how I can make it work?
 
Best regards.

Helpful resources

Announcements
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.