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
bilingual
Helper V
Helper V

Related table with different filter functions

Hi i have a data table with following where i have a lot of entries like:

 

ENTRYPART OF ENTRY WHICH DEFINES TYPE
AAHEPXXXXPX
DKDEFXXXXFX
5DKDKE5XXXX
6EOEEM6XXXX
7ENEEG7XXXX
S2OLDCS2OLDC

 

My translation table needs to be able to be able to decode the data with both full, Left and  Right functions. 

In SAP i use If(Substr(Trim([ENTRY]);4;2))="PX") Then "Public export", and then add RIGHT/LEFT functions for every type without a translation table.

 

Could i build a tranlations table in Power BI which would better or is IF(RIGHT/LEFT the only way to solve it?

 

 

 

1 ACCEPTED SOLUTION

Hi @bilingual ,

 

 

Column = SWITCH(
    TRUE(),
    SEARCH("FX",'Table20'[ENTRY],1,0) > 0 , "Public Export",
     SEARCH("7",'Table20'[ENTRY],1,0) > 0 , "Local Export",
      SEARCH("S2OLDC",'Table20'[ENTRY],1,0) > 0 , "Special Export"
)

 

1.jpg

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

View solution in original post

9 REPLIES 9
bilingual
Helper V
Helper V

Hi again, so sorry, can see it is not very clear writtten, i try again with an example, how it is working in SAP:

 

ENTRYPART OF ENTRY WHICH DEFINES TYPETYPE DEFINED FROM PART OF ENTRYCURRENT SAP FORMULA
DKDEFX"FX"Public export=If(Substr(Trim([ENTRY]);4;2))="PX") Then "Public export"
7ENEEG"7"Local export=If(Substr(Trim([ENTRY]);1;1))="7") Then "Local export"
S2OLDCS2OLDCSpecial export=If(Substr(Trim([ENTRY]);1;6))="S2OLDC") Then "Special export"

 

All entries have a length of 6 characters

 

Hi @bilingual ,

 

You will need SEARCH ,MID, LEFT functions to extract the value.

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @bilingual ,

 

 

Column = SWITCH(
    TRUE(),
    SEARCH("FX",'Table20'[ENTRY],1,0) > 0 , "Public Export",
     SEARCH("7",'Table20'[ENTRY],1,0) > 0 , "Local Export",
      SEARCH("S2OLDC",'Table20'[ENTRY],1,0) > 0 , "Special Export"
)

 

1.jpg

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

Hi, very quick question, will it be better to use RIGHT, MID or LEFT in terms of memory compared to SEARCH, when i know the position of each variable?

HI @bilingual 

 

Thank you for more detail.

 

You can try SEARCH()

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





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

HI @bilingual 

 

Thank you for more detail.

 

Can you try SEARCH()

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

 

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
amitchandak
Super User
Super User

@bilingual , Not very clear

 

In DAX

If(MID(Trim([ENTRY]),4,2)="PX" , "Public export",blank())

 

in Power Query M
if Text.Middle(Text.Trim([ENTRY]),4,2)="PX" then "Public export"

harshnathani
Community Champion
Community Champion

Hi @bilingual ,

 

You can use FIND,SEARCH function and a combine them with LEFT ,RIGHT and MID Function in Power BI.

 

Can you share some sample data and expected output.

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

pranit828
Community Champion
Community Champion

HI @bilingual 

 

Not very clear.

Can you please post sample output or all SAP condition for each row.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.