简体   繁体   English

用于过滤的 Power BI 代码。 M语言调试代码(在Power BI中创建列)

[英]Power BI Code for filtering. Debugging Codes in M language ( Creating a column in Power BI)

I am having error Please can you help out, as I am new here我有错误请你帮忙,因为我是新来的

= Table.AddColumn(#"Changed Type", "Custom", each if ([Application Name] = "BBK" and (Text.Contains([Entitlement Key], "_ADMIN_BBK") or Text.Contains([Entitlement Key], "_UPDATE_BBK") or Text.Contains([Entitlement Key], "_READ_BBK")) then "YES" else if [Application Name] = "CBJ" and (Text.Contains([Entitlement Key], "_ADMIN_CBJ") or Text.Contains([Entitlement Key],"_UPDATE_CBJ") or Text.Contains([Entitlement Key],"_EXECUTE_CBJ") or Text.Contains([Entitlement Key],"_READ_CBJ")) then "YES"else if [Application Name] = "NEX" and Text.Contains([Entitlement Key], "_READ_NEX") then "YES" else if [Application Name] = "SNR" and Text.Contains([Entitlement Key], "_READ_SNR" ) then "YES" else "NO")))) = Table.AddColumn(#"Changed Type", "Custom", each if ([Application Name] = "BBK" and (Text.Contains([Entitlement Key], "_ADMIN_BBK") or Text.Contains([Entitlement Key] , "_UPDATE_BBK") 或 Text.Contains([Entitlement Key], "_READ_BBK")) then "YES" else if [Application Name] = "CBJ" and (Text.Contains([Entitlement Key], "_ADMIN_CBJ") 或Text.Contains([Entitlement Key],"_UPDATE_CBJ") or Text.Contains([Entitlement Key],"_EXECUTE_CBJ") or Text.Contains([Entitlement Key],"_READ_CBJ")) then "YES" else if [Application Name] = "NEX" and Text.Contains([Entitlement Key], "_READ_NEX") then "YES" else if [Application Name] = "SNR" and Text.Contains([Entitlement Key], "_READ_SNR" ) then "是”否则“否”))))

Its hard to tell what you are doing, but try很难说你在做什么,但试试

= Table.AddColumn(#"Changed Type", "Custom", each 

if (
[Application Name] = "BBK" and (Text.Contains([Entitlement Key], "_ADMIN_BBK") or Text.Contains([Entitlement Key], "_UPDATE_BBK") or Text.Contains([Entitlement Key], "_READ_BBK"))) then "YES"
else if ([Application Name] = "CBJ" and (Text.Contains([Entitlement Key], "_ADMIN_CBJ") or Text.Contains([Entitlement Key],"_UPDATE_CBJ") or Text.Contains([Entitlement Key],"_EXECUTE_CBJ") or Text.Contains([Entitlement Key],"_READ_CBJ"))) then "YES"
else if [Application Name] = "NEX" and Text.Contains([Entitlement Key], "_READ_NEX") then "YES"
else if [Application Name] = "SNR" and Text.Contains([Entitlement Key], "_READ_SNR" ) then "YES"
else "NO"
)

I did what you should have done -- tried this piece by piece, making sure that each row evaluated before adding the next.我做了你应该做的 - 逐个尝试,确保在添加下一行之前评估每一行。 You had too few parenthesis on some places and too many in others某些地方的括号太少,而其他地方的括号太多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM