Forum Discussion
Pivot Table - Subtotals - Custom Calculations
- Anonymous9 years ago
jcarrier,
Directly create the following measure.
ADJ = ABS(SUM('Table '[Balance]))
Regards,
Lydia - 9 years ago
Hi Lydia -
Happy to mark as solved, my point was that ABS works completely differently in Excel than DAX so the outcome is quite unexpected. If you use absolute value in Excel the subtotals would be impacted by the absolute value formula itself. Yet, in DAX measures, ABS seems to allow expression of +/- values to all display as positive yet the subtotals themselves obey the original sign values. That is quite unexpected indeed, and it's extremely powerful too. Thanks again.
jcarrier
jcarrier,
Create the following measure in your table.
Measure 2 = ABS(SUM('Table'[Balance]))
ADJ = IF(COUNTROWS(VALUES('Table'[REPORT_CATEGORY]))=1, [Measure 2],SUMX(VALUES('Table'[REPORT_CATEGORY]),[Measure 2]))
Regards,
Lydia
Lydia -
I tried the provided measure but it does not give the intended result. The ADJ column for the Profit and Loss must match the Balance column with all of the values for the column showing as positive. The measure provided shows the correct summation for the Expense categories but does not properly calculate subtotals for Revenue - COGS or Revenue - COGS - Expenses. Please advise on a solution. Thanks again.
jcarrier