Hello–I am fairly new to Power BI and am excited about learning more. The DNA Enterprise website has been very helpful to my knowledge development. I work for a company that assists local governments.
I am trying to find how to calculate a forecast of future tax revenues by using the average of 5 years of taxes. I have a measure started that I obtained from one of Sam’s videos on forecasting. What I have so far is below.
However–what I am wanting to do is to forecast the average with the highest and lowest years eliminated from the calculation. I have been unable to find how to calculate the MAX of the 5 years, MIN of the 5 years, and then eliminate those figures from the calcualation.
Sorry for the delay - was needlessly overcomplicating things. Just needed to nest the MIN and MAX functions to get around the two parameter limit. Try this:
Tax Forecast2 =
VAR TaxesLY = CALCULATE( [Total Taxes], DATEADD( Dates[date], -1, YEAR))
VAR Taxes2YrsAgo = CALCULATE( [Total Taxes], DATEADD( Dates[date], -2, YEAR))
VAR Taxes3YrsAgo = CALCULATE( [Total Taxes], DATEADD( Dates[date], -3, YEAR))
VAR Taxes4YrsAgo = CALCULATE( [Total Taxes], DATEADD( Dates[date], -4, YEAR))
VAR Taxes5YrsAgo = CALCULATE( [Total Taxes], DATEADD( Dates[date], -5, YEAR))
VAR MaxLast5 = MAX(TaxesLY, MAX(Taxes2YrsAgo, MAX(Taxes3YrsAgo, MAX(Taxes4YrsAgo, Taxes5YrsAgo))))
VAR MinLast5 = MIN(TaxesLY, MIN(Taxes2YrsAgo, MIN(Taxes3YrsAgo, MIN(Taxes4YrsAgo, Taxes5YrsAgo))))
VAR Total5 = TaxesLY + Taxes2YrsAgo + Taxes3YrsAgo + Taxes4YrsAgo + Taxes5YrsAgo
VAR Middle3 = Total5 - MinLast5 - MaxLast5
VAR AvgMiddle3 = DIVIDE(Middle3, 3, 0)
I’d like to offer an alternative to this construct. Because you can create a single column called “Value” using list operators { } combine that with an iterator and you get: