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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.