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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
harib
Post Patron
Post Patron

How to get specific values from the existing column to new column in Power BI

Hello Friends,

 

I want to get specific values from the existing column to new column .Is it possible with like or search condition in Dax.

Let's say in the below table i want only *Target values from the Name column like Target Values column as mentioned .

 

Name             Value           Target values

 

A Metric         1                   

B Target         1                  B Target

C Target         1                  C Target'

C Metric         1                  

AA Metric       1    

AA Target       1                AA Target

DD                  1

FF                   1

G Target          1                G Target

 

If it's possible kindly let me know.

Thanks in advance 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@harib 

 

As a Calc Column, try this

 

=if(search("Target",[Name],1,0)>0,[Name])

Regards
Zubair

Please try my custom visuals

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi Harib,

 

I would suggest the easiest way to do this is in the query editor rather than DAX. But the post below has a solution that explains how to do it in both:

 

https://community.powerbi.com/t5/Desktop/If-text-column-CONTAINS-specified-value-give-me-what-I-want...

 

Hope that helps!

 

Matt

vanessafvg
Super User
Super User

@harib  depends on what you trying to do, you can do stuff in dax and power query

 

in dax there is

 

or a simple  new column;

Lookingforgreenvalue= CALCULATE(VALUES(Test[Colour]), Test[Colour] = "Green")

 

 

https://docs.microsoft.com/en-us/dax/search-function-dax

https://docs.microsoft.com/en-us/dax/find-function-dax

these just find po

they return the position of what you looking for...

what would be the condition of the copy?   

 

also fairly simple to do in power query in a conditional or custom column, why would you do it in dax?  is it for the user to do something or is it part of your data transformations?

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Zubair_Muhammad
Community Champion
Community Champion

@harib 

 

As a Calc Column, try this

 

=if(search("Target",[Name],1,0)>0,[Name])

Regards
Zubair

Please try my custom visuals

Hi, I have two Data sets as below.

Table 1:

ProductYTD1YTD2YTD3Total
A10151237
B5218
C61310
Total   55

 

Table 2:

MonthYTD
JanYTD1
FebYTD2
MarYTD3

 

I want to create a NewColumn (or maybe a new measure) in Table 1 which is dependent on a Slicer (value: Jan, Feb, Mar) in the Report. 

For example, if filtered value is "Jan" in the slicer, the NewColumn will get YTD1 column, if "Feb", then it will get YTD2 column. 

 

What is the way to do this? 

@Zubair_Muhammad 

 

Working fine. Thanks a Lot Zubair . 🙂

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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