如何将 URL-包含 Excel 公式转换为 Power BI 计算列?

How to convert URL-contains Excel formula to Power BI calculated column?

我使用这个 Excel 公式来判断 A 列中的 URL 是否包含 '/amp/' 字符串:

 = IF(OR(SUMPRODUCT(--((ISERR(SEARCH({"/amp/"},a2)))))>0),FALSE,TRUE)))))))))))))

我如何在 Power BI 的计算 column/measure 中做到这一点?

您可以使用 FIND function to search for the /amp/ in the column where the URL is stored. You can define the value to be returned, if the pattern is not found, but not the value in case it is. So you can use IF 来自由定义 "contains" 和 "do not contains" 值。

=IF(FIND("/amp/", 'TableName'[ColumnWithURL], -1) = -1, <value_if_true>, <value_if_false>)