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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

creating identifier based on column name

Hello PowerBi Friends,

 

i'm direct querying the follow table.

 

how can i create an identifier column, based on the name of each columns?

 

for example, i want a "LD" for all the columns that starts with "LD" and "DS" for all the columns that start with "DS"

 

so when end user select the identifier, the corresponding columns will show up in the table.

 

Capture.JPGCapture1.JPG

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , if this direct query then you have to unpivot that at source and create a new column with DS and LS.

 

In import mode in power query unpivot ,all such column

 

and create a new column like

if Text.Upper(Text.Start([Attribute],2)) = "LD" then "LD"

else if Text.Upper(Text.Start([Attribute],2)) = "DS" then "DS" else [Attribute]

 

 

and use this in visual

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , if this direct query then you have to unpivot that at source and create a new column with DS and LS.

 

In import mode in power query unpivot ,all such column

 

and create a new column like

if Text.Upper(Text.Start([Attribute],2)) = "LD" then "LD"

else if Text.Upper(Text.Start([Attribute],2)) = "DS" then "DS" else [Attribute]

 

 

and use this in visual

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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