Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
* My dax below is giving me correct row subtotal and row grand totals. BUT it is giving me incorrect column grandtotals.
* The grand totals should be the sum of the [Tonnes Actual] component up to current monthyear + [Tonnes Budget] component for future monthyear values from current monthyear value.
* Instead it is giving me only the [Tonnes Budget] values across all dates.
Please help.
Solved! Go to Solution.
I have the solution DAX below just to give closure to this thread. Thank you for your efforts.
I have the solution DAX below just to give closure to this thread. Thank you for your efforts.
HI @arnie ,
Please Try the following DAX code:
_Calc. Budget =
VAR CurrentMonthYear = VALUE(FORMAT(TODAY(), "YYYYMM"))
VAR ColumnDate = MAX('Date'[Date])
VAR ColumnMonthYear =
IF(
ISBLANK(ColumnDate),
BLANK(),
VALUE(FORMAT(ColumnDate, "YYYYMM"))
)
VAR IsGrandTotal = ISINSCOPE('Date'[Month Year]) = FALSE
VAR ActualValue =
IF(
ColumnMonthYear <= CurrentMonthYear,
[Tonnes Actual],
BLANK()
)
VAR BudgetValue =
IF(
ColumnMonthYear > CurrentMonthYear,
[Tonnes Budget],
BLANK()
)
// Correcting the Actual Total to sum up until the current month-year
VAR ActualTotal =
CALCULATE(
[Tonnes Actual],
REMOVEFILTERS('Date'),
'Date'[Month Year] <= CurrentMonthYear
)
// Correcting the Budget Total to sum from future months beyond the current month-year
VAR BudgetTotal =
CALCULATE(
[Tonnes Budget],
REMOVEFILTERS('Date'),
'Date'[Month Year] > CurrentMonthYear
)
RETURN
IF(
IsGrandTotal,
// For Grand Total: Combine the corrected Actual and Budget totals
ActualTotal + BudgetTotal,
// For individual rows, show the Actual or Budget based on the current month-year
ActualValue + BudgetValue
)
Modified version of your DAX measure:
_Calc. Budget =
VAR CurrentMonthYear = VALUE(FORMAT(TODAY(), "YYYYMM"))
VAR ColumnDate = MAX('Date'[Date])
VAR ColumnMonthYear =
IF(
ISBLANK(ColumnDate),
BLANK(),
VALUE(FORMAT(ColumnDate, "YYYYMM"))
)
VAR IsGrandTotal = ISINSCOPE('Date'[Date]) = FALSE
VAR ActualValue =
IF(
ColumnMonthYear <= CurrentMonthYear,
[Tonnes Actual],
BLANK()
)
VAR BudgetValue =
IF(
ColumnMonthYear > CurrentMonthYear,
[Tonnes Budget],
BLANK()
)
VAR ActualTotal =
CALCULATE(
[Tonnes Actual],
FILTER(
ALL('Date'),
VALUE('Date'[Month Year]) <= CurrentMonthYear
)
)
VAR BudgetTotal =
CALCULATE(
[Tonnes Budget],
FILTER(
ALL('Date'),
VALUE('Date'[Month Year]) > CurrentMonthYear
)
)
RETURN
IF(
IsGrandTotal,
ActualTotal + BudgetTotal,
ActualValue + BudgetValue
)
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
* Hi Kedar, please see my screenshots below.
* As you can see, Tonnes + Budget does add up correctly for corresponding date, but the column grand total (3rd table) is the same as the total for budget (2nd table). I need the highlighted totals for Actuals to ADD up with the budget values from Dec 24 onwards to give grand total of 364,007.
* Your solution is not adding up also, but thanks for trying.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
145 | |
87 | |
66 | |
51 | |
45 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |