The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone,
I am trying to calculate incremental values based on the latest value.
As there was a community post very similar to my case, I customized the sample partially.
*some of the VAR or column names doesn't make sense as I kept the names from the sample
However, the "else" part of the IF syntax is not calculating correctly.
Please tell me where I am wrong and how I could fix this.
[Sample]
Using the parameter, Growth %
fy1+(fy2/365) & Forecast =
VAR _lastSalesMonth = [Last Sales Month (Last Updated)]
VAR _lastMonthTotal = CALCULATE(SUM('indices_eps (Local)'[fy1+(fy2/365)]),ALL('DateTable'),'DateTable'[Date]=_lastSalesMonth)
VAR _thisMonth = MAX('DateTable'[Date])
VAR _power = DATEDIFF(_lastSalesMonth,_thisMonth,DAY)
RETURN
IF(_thisMonth<=_lastSalesMonth,SUM('indices_eps (Local)'[fy1+(fy2/365)]),_lastMonthTotal*POWER(1+[Growth % Value]/100,_power))
[My ver. which doesn't calculate "else"]
colmn calculations are the measure calculations with the formula shown as the column name
Actual & Forecast =
VAR _lastUpdatedDate = [Last Updated Date]
VAR _lastUpdatedValue = CALCULATE(SUM('indices_eps (Local)'[fy1+(fy2/365)]),ALL('DateTable'),'DateTable'[Date]=_lastUpdatedDate)
VAR _thisMonth = MAX('DateTable'[Date])
VAR _power = DATEDIFF(_lastUpdatedDate,_thisMonth,DAY)
RETURN
IF(_thisMonth<=_lastUpdatedDate,SUM('indices_eps (Local)'[fy1+(fy2/365)]),_lastUpdatedValue*POWER(1+[((fy2-fy1)/fy1)/365)],_power))
I appreciate your kind advise and help.
Thank you.
Peru