March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I need to replicate this code in Power BI, How can i achive this.
"?" refers to any single character and "*" refers to zero or more characters
If {srs_crs.crs_code} like ["PMF*","PMP*","PDF*","PDP*","PTF*","PTP*"] then "Primary PGCE" else "" +
If {srs_crs.crs_code} like ["Q?F*","Q?P*","T?F*","T?P*"] then "Primary ITE" else "" +
If {srs_crs.crs_code} like ["PMY*","PDY*","PTY*"] then "Secondary PGCE" else "" +
If {srs_crs.crs_code} like "Q?Y*" then "Secondary ITE" else "" +
If {srs_crs.crs_code} like ["B?P4*","BAJ*","BAS*","BLS*","BSJ*","BSS*","T?S*"] then "First Degree" else "" +
If {srs_crs.crs_code} like "F*" then "Foundation Degree" else "" +
If {srs_crs.crs_code} like "AO*" then "Assessment Only" else "" +
If {srs_crs.crs_code} like "AK*" then "SKE" else "" +
If {srs_crs.crs_code} like "PS*" then "SCITT" else "" +
If {srs_crs.crs_code} like "ANP*" then "EYITT" else "" +
If {srs_crs.crs_code} like "AXS*" then "Exchange" else "" +
If {srs_crs.crs_code} like ["R*","M*"] then "Postgraduate" else "Other Undergraduate"
Solved! Go to Solution.
Use this in power query as a custom column and use the following custom M code.
if Text.StartsWith([crs_code], "PMF") or Text.StartsWith([crs_code], "PMP") or Text.StartsWith([crs_code], "PDF") or Text.StartsWith([crs_code], "PDP") or Text.StartsWith([crs_code], "PTF") or Text.StartsWith([crs_code], "PTP") then "Primary PGCE"
else if (Text.StartsWith([crs_code], "Q") and Text.Middle([crs_code], 1, 1) in {"F","P"}) or (Text.StartsWith([crs_code], "T") and Text.Middle([crs_code], 1, 1) in {"F","P"}) then "Primary ITE"
else if Text.StartsWith([crs_code], "PMY") or Text.StartsWith([crs_code], "PDY") or Text.StartsWith([crs_code], "PTY") then "Secondary PGCE"
else if Text.StartsWith([crs_code], "Q") and Text.Middle([crs_code], 1, 1) = "Y" then "Secondary ITE"
else if Text.StartsWith([crs_code], "B") and Text.Middle([crs_code], 1, 1) in {"P4","AJ","AS","LS","SJ","SS"} or (Text.StartsWith([crs_code], "T") and Text.Middle([crs_code], 1, 1) = "S") then "First Degree"
else if Text.StartsWith([crs_code], "F") then "Foundation Degree"
else if Text.StartsWith([crs_code], "AO") then "Assessment Only"
else if Text.StartsWith([crs_code], "AK") then "SKE"
else if Text.StartsWith([crs_code], "PS") then "SCITT"
else if Text.StartsWith([crs_code], "ANP") then "EYITT"
else if Text.StartsWith([crs_code], "AXS") then "Exchange"
else if Text.StartsWith([crs_code], "R") or Text.StartsWith([crs_code], "M") then "Postgraduate"
else "Other Undergraduate"
Try this and let me know if this works.
Use this in power query as a custom column and use the following custom M code.
if Text.StartsWith([crs_code], "PMF") or Text.StartsWith([crs_code], "PMP") or Text.StartsWith([crs_code], "PDF") or Text.StartsWith([crs_code], "PDP") or Text.StartsWith([crs_code], "PTF") or Text.StartsWith([crs_code], "PTP") then "Primary PGCE"
else if (Text.StartsWith([crs_code], "Q") and Text.Middle([crs_code], 1, 1) in {"F","P"}) or (Text.StartsWith([crs_code], "T") and Text.Middle([crs_code], 1, 1) in {"F","P"}) then "Primary ITE"
else if Text.StartsWith([crs_code], "PMY") or Text.StartsWith([crs_code], "PDY") or Text.StartsWith([crs_code], "PTY") then "Secondary PGCE"
else if Text.StartsWith([crs_code], "Q") and Text.Middle([crs_code], 1, 1) = "Y" then "Secondary ITE"
else if Text.StartsWith([crs_code], "B") and Text.Middle([crs_code], 1, 1) in {"P4","AJ","AS","LS","SJ","SS"} or (Text.StartsWith([crs_code], "T") and Text.Middle([crs_code], 1, 1) = "S") then "First Degree"
else if Text.StartsWith([crs_code], "F") then "Foundation Degree"
else if Text.StartsWith([crs_code], "AO") then "Assessment Only"
else if Text.StartsWith([crs_code], "AK") then "SKE"
else if Text.StartsWith([crs_code], "PS") then "SCITT"
else if Text.StartsWith([crs_code], "ANP") then "EYITT"
else if Text.StartsWith([crs_code], "AXS") then "Exchange"
else if Text.StartsWith([crs_code], "R") or Text.StartsWith([crs_code], "M") then "Postgraduate"
else "Other Undergraduate"
Try this and let me know if this works.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
119 | |
88 | |
73 | |
67 | |
49 |
User | Count |
---|---|
199 | |
141 | |
97 | |
79 | |
68 |