[英]Power BI - Add column using M to count 2 years of data
I have 2 years of data on a bar chart and an x-axis that I created by concatenating Year and Month Number into a separate column called "Year - Month" 我在条形图和x轴上有2年的数据,这些数据是通过将Year和Month Number串联到一个单独的列(称为“ Year-Month”)中创建的
Number.ToText([Year]) & Number.ToText([Month Number])
The result is 结果是
20171
20172
20173
20174
...
201711
201712
20181
20182
20183
20184
20185
...
How can I create a calculated column in M to add a number column that counts 1 - 24 which will allow me to sort the x axis on the chart? 如何在M中创建一个计算列以添加一个计数为1-24的数字列,这将允许我对图表上的x轴进行排序?
Also how can I make this dynamic allowing any new data in the report to auto increment to 25, 26, 27... into year 3? 另外,如何使这种动态变化动态化,使报告中的任何新数据在第3年自动增加到25、26、27 ...?
并非完全符合您的要求,但是您可能更愿意创建一个日期列,该日期列可用于轴。
= #date([Year],[Month Number],1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.