Power BI:根据去年的方差%计算方差和
Power BI: Calculate sum of variance based on the variance % of last year
我有一个要求,我需要计算所有 [方差] 的总和(减少期限),其中上年末的 [方差 %] 小于或等于 -1。
为此,我使用了这个公式:
Term Reductions =
var _date = MAX('Date-Processing'[Date])
var _month = MONTH(_date)
var _prior_year_end_date = IF(_month=1,EOMONTH(_date,-13),EOMONTH(_date,-_month))
var _prior_year_end_variance = CALCULATE([Variance %],FILTER(ALL('Date-Processing'),'Date-Processing'[Date]=_prior_year_end_date),FILTER(AccountLoan,AccountLoan[RiskRatingCategoryCode]<>"S" && AccountLoan[RiskRatingCategoryCode]<>"W"))
return SUMX(SUMMARIZE(Customer,Customer[CustomerName],"Variance",if(_prior_year_end_variance<=-1,[Variance],BLANK())),[Variance])
如果总体(所有客户)[方差 %] 小于或等于 -1,则公式显示值,否则显示空白。
任何人都可以帮助我理解,我如何计算客户级别的 [方差 %],这样即使总体 [方差 %] 大于 -1,但任何客户都有 [方差 %]小于或等于-1,那么输出应该是这些客户的[方差]之和
如果我正确理解了你的问题,我认为你只需要将上一年的计算移入 SUMX table:
Term Reductions =
var _date = MAX('Date-Processing'[Date])
var _month = MONTH(_date)
var _prior_year_end_date = IF(_month=1,EOMONTH(_date,-13),EOMONTH(_date,-_month))
return SUMX(
SUMMARIZE(Customer,
Customer[CustomerName],
"PriorEnd", CALCULATE([Variance %],FILTER(ALL('Date-Processing'),'Date-Processing'[Date]=_prior_year_end_date),FILTER(AccountLoan,AccountLoan[RiskRatingCategoryCode]<>"S" && AccountLoan[RiskRatingCategoryCode]<>"W")),
"Variance", [Variance]),
IF([PriorEnd]<=-1,[Variance],BLANK()))
我有一个要求,我需要计算所有 [方差] 的总和(减少期限),其中上年末的 [方差 %] 小于或等于 -1。
为此,我使用了这个公式:
Term Reductions =
var _date = MAX('Date-Processing'[Date])
var _month = MONTH(_date)
var _prior_year_end_date = IF(_month=1,EOMONTH(_date,-13),EOMONTH(_date,-_month))
var _prior_year_end_variance = CALCULATE([Variance %],FILTER(ALL('Date-Processing'),'Date-Processing'[Date]=_prior_year_end_date),FILTER(AccountLoan,AccountLoan[RiskRatingCategoryCode]<>"S" && AccountLoan[RiskRatingCategoryCode]<>"W"))
return SUMX(SUMMARIZE(Customer,Customer[CustomerName],"Variance",if(_prior_year_end_variance<=-1,[Variance],BLANK())),[Variance])
如果总体(所有客户)[方差 %] 小于或等于 -1,则公式显示值,否则显示空白。
任何人都可以帮助我理解,我如何计算客户级别的 [方差 %],这样即使总体 [方差 %] 大于 -1,但任何客户都有 [方差 %]小于或等于-1,那么输出应该是这些客户的[方差]之和
如果我正确理解了你的问题,我认为你只需要将上一年的计算移入 SUMX table:
Term Reductions =
var _date = MAX('Date-Processing'[Date])
var _month = MONTH(_date)
var _prior_year_end_date = IF(_month=1,EOMONTH(_date,-13),EOMONTH(_date,-_month))
return SUMX(
SUMMARIZE(Customer,
Customer[CustomerName],
"PriorEnd", CALCULATE([Variance %],FILTER(ALL('Date-Processing'),'Date-Processing'[Date]=_prior_year_end_date),FILTER(AccountLoan,AccountLoan[RiskRatingCategoryCode]<>"S" && AccountLoan[RiskRatingCategoryCode]<>"W")),
"Variance", [Variance]),
IF([PriorEnd]<=-1,[Variance],BLANK()))