在Power BI中,我有一个M查询,用于测试列中的值是否等于或等于null.
当我添加语句[Sale.Revenue] <> null我得到一个错误,但它工作正常,[UserRole.Name] = null它工作正常.仅通过删除语句并将其添加回来进行测试.
We cannot convert the value null to type Logical.
这似乎应该工作,但只是无法搞清楚.
add_user_role_group = Table.AddColumn(
join_expand_sale,
"UserRole.Group1",
each (
if [UserRole.Name] = null and
[Sale.Revenue] <> null then
"Group1"
else if Text.Contains([UserRole.Name], "Manager") then
"Group2"
else
"Undefined"
)
)
Run Code Online (Sandbox Code Playgroud)
我确信它显然是明显的:/感谢您对此的看法.
我有一个包含网站域的专栏,例如:
我想创建一个条件列,它根据给定的域列表告诉我某个域是“媒体”还是“社区”。我可以通过 PowerBi 中的“创建条件列”手动完成此操作,但这需要我一百万年的时间。相反,我尝试过:
"Added Conditional Column18" = Table.AddColumn(#"Added Conditional Column17", "sitio.tipo", each if Text.Contains([Content.thread.site], "elpais OR elmundo OR elconfidencial OR abc OR lavanguardia OR 20minutos OR eldiario OR rtve OR elespanol OR eleconomista OR publico OR telecinco OR lasexta OR cuatro") then "medio" else "comunidad" )
Run Code Online (Sandbox Code Playgroud)
不工作。还尝试过:
"Added Conditional Column18" = Table.AddColumn(#"Added Conditional Column17", "sitio.tipo", each if Text.Contains([Content.thread.site], "elpais" OR "elmundo" OR "elconfidencial" OR "abc" OR "lavanguardia" OR "20minutos" OR "eldiario" OR "rtve" OR "elespanol" …Run Code Online (Sandbox Code Playgroud) 用户收到月度客户报告,其中包含月度销售总额(几万行)。销售额显示为总销售额,我试图找到一个 powerquery 解决方案来获得实际销售额作为 (*Required*) 输出:
???????????????????????????????????????????????
? Year ? Month ? StoreID ? Sales ? *Required* ?
???????????????????????????????????????????????
? 2017 ? 10 ? 1 ? 5 ? 5 ?
? 2017 ? 11 ? 1 ? 11 ? 6 ?
? 2017 ? 12 ? 1 ? 18 ? 7 ?
? 2017 ? 11 ? 2 ? 10 ? 10 ?
???????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)
在 tSQL 我会做类似的事情
Sales - LAG(Sales,1,0)OVER(Partiton by Year, StoreID Order by Month)
Run Code Online (Sandbox Code Playgroud)
A simular question (but in …
如何转换这个
qqqq%2Fwwww%3Feeee%26rrrr%3Dtttt
Run Code Online (Sandbox Code Playgroud)
对此
qqqq/wwww?eeee&rrrr=tttt
Run Code Online (Sandbox Code Playgroud)
?
有没有简单的解码方法?
我正在开发一个PowerBI项目.我想将一列小数(百分比)转换为-1到1的范围.
这是我现在正在使用的表格:
FirstName | Score
Jack | 0.75
John | 0.50
Reese | 0.00
Mike | 1.00
Run Code Online (Sandbox Code Playgroud)
并且期望的结果是:
FirstName | Score
Jack | 0.50
John | 0.00
Reese | -1.00
Mike | 1.00
Run Code Online (Sandbox Code Playgroud)
我对这背后的数学感到不安.如果我得到那部分,我可以通过在PowerBI中使用m语言来实现.
有什么想法,建议吗?
我想从前一行获得一个值.
我按照这篇文章的建议尝试了以下代码:
Table.AddColumn(#"Added index", "custom column", each {[Index]-1}[column name])
Run Code Online (Sandbox Code Playgroud)
但它抛出了这个错误:
Cannot use field access fot type List
Run Code Online (Sandbox Code Playgroud)
请帮忙,我做错了什么?
我有两个Power BI文件,每个文件都有很多来源.有没有一种方便的方法来移动所有查询并在M中完成所有转换?换句话说,我想将两个文件中的所有查询都放在一个位置.
我想用 powerquery 替换“ValueToReplace” null。这不起作用(返回错误):
Table.ReplaceValue(#"Previous Step","ValueToReplace", null ,Replacer.ReplaceText,{"Col1"})
Run Code Online (Sandbox Code Playgroud)
这有效,但它返回 "" 而不是 null:
Table.ReplaceValue(#"Previous Step","ValueToReplace","",Replacer.ReplaceText,{"Col1"})
Run Code Online (Sandbox Code Playgroud)