Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
68 | |
60 | |
51 | |
36 | |
36 |
User | Count |
---|---|
84 | |
72 | |
58 | |
45 | |
44 |