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
Giada90
Helper III
Helper III

formula in power query editor

Hi,

I need to make this column in power query editor because I need to use it in a join.

The formula is this:

Column = SWITCH(TRUE(),

MID(VGOP14_SAP_DSH[Codice WBE/CdC],7,5)="C00.0" && VGOP14_SAP_DSH[Area Attività] ="50", "C00.0",

MID(VGOP14_SAP_DSH[Codice WBE/CdC],7,5)="C00.1" && VGOP14_SAP_DSH[Area Attività]="50", "C00.1",

MID(VGOP14_SAP_DSH[Codice WBE/CdC],7,5)="ik0.0" && VGOP14_SAP_DSH[Area Attività]="33","IK0",

"")
If I put this formula in a column in power query editor it gives me an error, how can I change it?
Thanks
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Giada90 , try like this

 

Column = if
Text.Middle(VGOP14_SAP_DSH[Codice WBE/CdC],6,5)="C00.0" and VGOP14_SAP_DSH[Area Attività] ="50" then "C00.0"
else if
Text.Middle((VGOP14_SAP_DSH[Codice WBE/CdC],6,5)="C00.1" && VGOP14_SAP_DSH[Area Attività]="50" theh "C00.1"
else if
Text.Middle((VGOP14_SAP_DSH[Codice WBE/CdC],6,5)="ik0.0" && VGOP14_SAP_DSH[Area Attività]="33" then "IK0"
else
""

 

Power Query - Text.Start, Text.Middle, Text.End: https://www.youtube.com/watch?v=vky4wPqm0O0

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Giada90 , try like this

 

Column = if
Text.Middle(VGOP14_SAP_DSH[Codice WBE/CdC],6,5)="C00.0" and VGOP14_SAP_DSH[Area Attività] ="50" then "C00.0"
else if
Text.Middle((VGOP14_SAP_DSH[Codice WBE/CdC],6,5)="C00.1" && VGOP14_SAP_DSH[Area Attività]="50" theh "C00.1"
else if
Text.Middle((VGOP14_SAP_DSH[Codice WBE/CdC],6,5)="ik0.0" && VGOP14_SAP_DSH[Area Attività]="33" then "IK0"
else
""

 

Power Query - Text.Start, Text.Middle, Text.End: https://www.youtube.com/watch?v=vky4wPqm0O0

Thanks

 

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.