Forum Discussion
balreenBDO
3 years agoFrequent Visitor
Totals calculating incorrectly
Hello, I have the following formula which determines whether actuals or forecast should populated the months column. Each individual month column returns correct values but the total column returns incorrect values. How can I fix this in my matrix table?
EOY Comparative =
EOY Comparative =
Var selectionMonth = SELECTEDVALUE('Calendar Date To'[FiscalMonthName])
Var selectionMonthNumber = SWITCH(UPPER(selectionMonth), "JAN", 1, "FEB", 2, "MAR", 3, "APR", 4, "MAY", 5, "JUN", 6, "JUL", 7, "AUG", 8, "SEP", 9, "OCT", 10, "NOV", 11, "DEC", 12, BLANK())
Var selectionYear = IF (selectionMonthNumber >=7,
YEAR(SELECTEDVALUE('Calendar Date To'[Fiscal Year]))-1,
YEAR(SELECTEDVALUE('Calendar Date To'[Fiscal Year])))
Var slicerYYMM = selectionYear& "-" & Format(selectionMonthNumber,"00")
var selYear = Max(RawData[FP])
Var Outcome = CALCULATE(IF(
DATEVALUE(selYear) <= DATEVALUE(SlicerYYMM),
[SumAct Formatted MTD],
[EOY Month Value]
), YEAR('Calendar'[Fiscal Year]) = YEAR(SELECTEDVALUE('Calendar Date To'[Fiscal Year])))
Return
Outcome
Expected Output:
The underlying DAX measure works in slotting in the Actual [SumAct Formatted MTD] and Forecast values [EOY Month Value] but the totals (in orange) will return incorrect values as it is unable to correctly add on the calculated forecast values [EOY Month Value].
EOY Month Value =
Var selectionMonth = SELECTEDVALUE('Calendar Date To'[FiscalMonthName])
Var selectionMonthNumber = SWITCH(UPPER(selectionMonth), "JAN", 1, "FEB", 2, "MAR", 3, "APR", 4, "MAY", 5, "JUN", 6, "JUL", 7, "AUG", 8, "SEP", 9, "OCT", 10, "NOV", 11, "DEC", 12, BLANK())
Var selectionYear = IF (selectionMonthNumber >=7,
YEAR(SELECTEDVALUE('Calendar Date To'[Fiscal Year]))-1,
YEAR(SELECTEDVALUE('Calendar Date To'[Fiscal Year])))
Var slicerYYMM = selectionYear& "-" & Format(selectionMonthNumber,"00")
Var _CD = CALCULATE([EOY Cummalative Days], ALL('Calendar'[Date]), 'Calendar'[Date] >= DATEVALUE(slicerYYMM) && 'Calendar'[Date]<= DATEVALUE(slicerYYMM))
Var _Var = ([YTD SUM EOY])/ _CD * [EOY Number of Days in Month]
Var _FormattedVar =
IF(
_Var <> 0,
FORMAT(
_Var,
SWITCH(
SELECTEDVALUE('Selections Slicer Figures Format'[Value2]),
"$","#,0;(#,0)",
"$ with Decimals","#,0.00;(#,0.00)",
"$'000","#,0;(#,0)",
"$m","#,0.0;(#,0.0)"
)
),0)
RETURN
_FormattedVar
Expected Output:
The underlying DAX measure works in slotting in the Actual [SumAct Formatted MTD] and Forecast values [EOY Month Value] but the totals (in orange) will return incorrect values as it is unable to correctly add on the calculated forecast values [EOY Month Value].
| Actual | Actual | Forecast | Forecast | Forecast | Forecast | Forecast | Forecast | Forecast | Forecast | Forecast | Forecast | ||
| July | August | September | October | November | December | January | February | March | April | May | June | Totals | |
| A | 52 | 52 | 27 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 30 | 401 |
| A1 | 16 | 16 | 9 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 131 |
| A2 | 16 | 16 | 9 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 131 |
| A3 | 20 | 20 | 9 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 139 |
12 Replies
- Ashish_MathurSuper User
Hi,
Share some data, explain the question and show the expected result.
- balreenBDOFrequent Visitor
Thanks Ashish_Mathur , I have added a sample result and further context.
- Ashish_MathurSuper User
Hi,
Share the download link of the PBI file.
- AhmedxSuper User
Is this what you are looking for?
you need to create a new measure and refer to your measure
https://1drv.ms/u/s!AiUZ0Ws7G26Rh0qcF1eO3MsAIeB1?e=nH0sOm- balreenBDOFrequent Visitor
Thanks Ahmedx , I tried this using my original data. It returns everything as 0. Would you happen to know the cause for it?
- AhmedxSuper User
I don't know, maybe it's because of the connection in the model, or the filter action. need to see your file