Power Bi 计算上个月的增长并在矩阵中显示 [英] Power Bi Calculate Growth Over Last Month and Show it in a Matrix
本文介绍了Power Bi 计算上个月的增长并在矩阵中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个下面的矩阵.我想计算 % Growth over month
并显示在矩阵中
字段
预期输出
公司 | 八月 | 九月 | GOLM % | 总计 |
---|---|---|---|---|
EBS-EASE商业解决方案 | 5940 | 0 | -100% | 5940 |
甜蜜咖啡馆 | 5940 | 0 | -100% | 5940 |
M/S SPORTS ONE PHARMACY | 1188 | -100% | 1188 |
尝试过的解决方案
我试过这个
DAX 文件
这是我的
I have a below matrix. I want to calculate the % Growth over month
and to show in a matrix
Fields
Expected Output
Company | August | September | GOLM % | Total |
---|---|---|---|---|
EBS-EASEBUSINESS SOLUTIONS | 5940 | 0 | -100% | 5940 |
SWEETREAT CAFE | 5940 | 0 | -100% | 5940 |
M/S SPORTS ONE PHARMACY | 1188 | -100% | 1188 |
Tried Solution
I have tried this Solution. But it's not working for me
GOLM =
VAR SelectedMonth =
SELECTEDVALUE (
Dates[Month],
MONTH ( TODAY () )
)
VAR PrevMonth =
SELECTEDVALUE (
'Source Data'[Month Updates],
MONTH ( TODAY () )
) - 1
VAR Growth =
CALCULATE(
DIVIDE(
SelectedMonth - PrevMonth,
PrevMonth,
0
)
)
RETURN
IF(
SELECTEDVALUE('Source Data'[Month Updates]) = PrevMonth,
SUM('Source Data'[SALES VALUE]),
IF(
SELECTEDVALUE('Source Data'[Month Updates]) = SelectedMonth,
SUM('Source Data'[SALES VALUE]),
FORMAT(Growth, "Percent")
)
)
Error
DAX File
Here is my Dax File
解决方案
Maybe you can do something like this;
First create a DAX table by using modelling pane;
Growth =
VAR CurrentMonth = FORMAT(TODAY(), "MMMM")
VAR PrevMonth = FORMAT(EOMONTH(TODAY(),-1), "MMMM")
VAR tmp1 = SELECTCOLUMNS('Source Data',
"SV_PrevMonth", CALCULATE(
SUM('Source Data'[SALES VALUE]),
'Source Data'[Month Updates]=PrevMonth),
"SV_CurrentMonth", CALCULATE(
SUM('Source Data'[SALES VALUE]),
'Source Data'[Month Updates]=CurrentMonth),
"PN", 'Source Data'[ProductNameFull],
"CN", 'Source Data'[CustomerNameFull],
"CP", 'Source Data'[Company]
)
return tmp1
Then add a measure to your table
GrowthPercentage = CALCULATE(DIVIDE(SUM(Growth[SV_CurrentMonth]) - SUM(Growth[SV_PrevMonth]), SUM(Growth[SV_PrevMonth]),0))*100
The result wil be like;
这篇关于Power Bi 计算上个月的增长并在矩阵中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文