我有一张表格-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];