cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hozefamk
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
Highlighted
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
Highlighted
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
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors