Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper I
Helper I

Convert QPR expression code to Power Query

Hi, I would like to replicate the similar conditional column in Power Query, How should I do it?




let twomillion = ["CD1009", "CD1011", "CD1012", "CD3007", "CD3008", "CD3010", "CD3013", "CD3015", "CD3016", "CD3028", "CD4001", "CD4002", "CD4004", "CD4005", "CD4008", "CD5003", "CD5009", "CD5010", "CD6001", "CD6002", "MC1003", "MC1004", "MC1005", "MC1006", "MC1009", "MC1010", "MC1012", "MC1014", "MC1015", "MC1017", "MC1018", "MC1019", "MC1020", "MC1022", "MC1023", "MC1024", "MC1025", "MC1026", "MC1027", "MC1028", "MC1029", "MC1033", "MC1034", "MC2001", "MC2002", "MC2003", "MC3007", "MC3009", "MC3010", "MC3011"];

let twohundredthousand = ["CS2013", "CS5008", "CS6001", "CS6002", "CS6003", "CS6004", "CS6005", "MK1006", "MK1013", "MK5005", "MK6002", "MK6003", "RD1049"]

let fivehundred = ["CS4002", "CS4003", "CS4004", "CS4005", "CS4006", "CS4010", "CS4011", "CS4012", "CS4013", "CS4015"];

let others = ["CD5008", "CS2021", "CS4016", "CS4017", "MC3001", "MC3002", "MC3004", "MC3005", "MK3002", "MK3011", "MK5003", "MK5004", "RD1024", "RD1027", "RD1029", "RD1030", "RD1031", "RD1032", "RD1034", "RD1035", "RD1036", "RD1039", "RD1041", "RD1042", "RD1043", "RD1044", "RD1045", "RD1048", "RD1051", "RD2016", "RD2019", "ZZ1001", "ZZ1002", "ZZ1003", "ZZ1011"]

if(Attribute("Risk Allocation")=="Medium risk") { 
if( (Attribute("Contract Policy Type")=="L2 - Simple" 
 && (
Attribute("Contract Value") >= 2000000 && Attribute("Spend Category").In(twomillion )  ||
Attribute("Contract Value") >= 200000 && Attribute("Spend Category").In(twohundredthousand ) ||
Attribute("Contract Value") >= 500000 && Attribute("Spend Category").In(fivehundred) ||
Attribute("Spend Category").In(others) 
)) || (Attribute("Contract Policy Type")=="L3 - Complex" || Attribute("Contracting Guidelines") == "An agreement must be used regardless of the amount.")

{"Compliant"}else{" Non-Compliant"} 
else if(Attribute("Risk Allocation")=="Low risk")
if(Attribute("Contracting Guidelines")=="For this nature of spend, create a Purchase Order.")

{" Non-Compliant"}else{""}




In my table, there are following columes:

Spend Category

Risk Allocation

Contracting Guidelines

Contract Policy Type

Contract Value


I would like to create a colume to indicate whether the row of the contract whether is it "Compliant" or "Non-compliant"


Thank you

Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Please show the expected outcome based on the sample data you provided.

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors