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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Jackie003
Frequent Visitor

Recreate command from Access to PowerQuery

Hello, 

I would like to recreate query from Access to PowerQuery M language, but I have a problem to do it. Could you help me with that?

 

IIf (Pivot1.[Sales Country Code]=Pivot1.[Sales Orig Country Code],
IIf((Pivot1.Supplier="LH" And Pivot1.[Sales Dest Country]="DE" ) OR (Pivot1.Supplier="LX" And Pivot1.[Sales Dest Country]="CH" )
OR (Pivot1.Supplier="OS" And Pivot1.[Sales Dest Country]="AT" ) OR (Pivot1.Supplier="SN" And Pivot1.[Sales Dest Country]="BE" ),"P2P",
IIF(Pivot1.[Sales Dest Area]="EU","EU<>P2P",Pivot1.[Sales Dest Area])) ,
IIF(Pivot1.[Sales Dest Country]= Pivot1.[Sales Country Code], "XBorder","Transversal" )) AS [O&D Traffic],

1 ACCEPTED SOLUTION
Jackie003
Frequent Visitor

Forget about it! I did it by myself. The solusion is:

if [Sales Country Code]=[Sales Orig Country Code] then
(if ([Supplier] = "LH" and [Sales Dest Country]="DE") or ([Supplier] = "LX" and [Sales Dest Country] = "CH")

or ([Supplier]="OS" and [Sales Dest Country]="AT") or ([Supplier]="SN" and [Sales Dest Country]="BE")

then "P2P"

else (if [Sales Dest Area]="EU" then "EU<>P2P" else [Sales Dest Area]))

else (if [Sales Dest Country]=[Sales Country Code] then "XBorder" else "Transversal")

View solution in original post

1 REPLY 1
Jackie003
Frequent Visitor

Forget about it! I did it by myself. The solusion is:

if [Sales Country Code]=[Sales Orig Country Code] then
(if ([Supplier] = "LH" and [Sales Dest Country]="DE") or ([Supplier] = "LX" and [Sales Dest Country] = "CH")

or ([Supplier]="OS" and [Sales Dest Country]="AT") or ([Supplier]="SN" and [Sales Dest Country]="BE")

then "P2P"

else (if [Sales Dest Area]="EU" then "EU<>P2P" else [Sales Dest Area]))

else (if [Sales Dest Country]=[Sales Country Code] then "XBorder" else "Transversal")

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors