我有一个表格 - Power BI 中的 MemberJoin,如下所示:
我想使用 M 语言从 MemberJoin 创建一个聚合表。可行吗?如果是,如何在 M 中做到这一点?
对应的 SQL 语句如下,然后是新表应该是什么样子的屏幕截图。
select [YTD Flag], [Member Type], year([Join Date]) "Year",
MONTH([Join Date]) "Month", datename(MONTH, [Join Date]) "MonthName",
[Join Channel], COUNT(*) "Count",
cast(count([YTD Flag]) as float) / cast(sum(count([YTD Flag]))
over (partition by year([Join Date])) as float) "Prcnt by Year"
from [MemberJoin]
group by [YTD Flag], [Member Type], [Join Channel], year([Join Date]), MONTH([Join Date]), datename(MONTH, [Join Date])
order by [YTD Flag] desc, [Member Type] desc, Year desc, Month, [Join Channel];