cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hozefamk Frequent Visitor
Frequent Visitor

Searching for first two letters in DAX

Problem statement:
If First 2 letter of ICODE = 51 then Computers else  If First 2 letter of ICODE = 11 then Raw MaterialsCapture.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft Phil_Seamark
Microsoft

Re: Searching for first two letters in DAX

Hi @hozefamk

 

You could try something along these lines

 

Column = 
    SWITCH(
           TRUE() ,
           MID('Table'[ICODE],1,2) = "51" , 'Table'[Computers] ,
           MID('Table'[ICODE],1,2) = "11" , 'Table'[Raw Materials] ,
           BLANK()
          )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
Microsoft Phil_Seamark
Microsoft

Re: Searching for first two letters in DAX

Hi @hozefamk

 

You could try something along these lines

 

Column = 
    SWITCH(
           TRUE() ,
           MID('Table'[ICODE],1,2) = "51" , 'Table'[Computers] ,
           MID('Table'[ICODE],1,2) = "11" , 'Table'[Raw Materials] ,
           BLANK()
          )

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors