Forum Discussion
Removing date filter
- Anonymous1 year ago
Hi tfr111 ,
Thank you for confirming the earlier results. The current calculation only iterates at the customer level, which leads to discrepancies in monthly subtotals when dates are shown in the visual. To resolve this, update the measure to iterate over both the date and customer context using the SUMMARIZE() function. This will ensure that monthly subtotals match the sum of customer rows, yearly totals add up correctly, and the all-time average price stays consistent across all date levels. Use the following DAX:
New Mix Sales (Correct Dates) = VAR _fixedAvgPrice = CALCULATE( DIVIDE(SUM('Data'[Sales]), SUM('Data'[Volume])), REMOVEFILTERS('Date') ) RETURN SUMX( SUMMARIZE( 'Data', 'Date'[Year], 'Date'[Month Number], 'Data'[Reporting Customer] ), _fixedAvgPrice * CALCULATE(SUM('Data'[Volume])) )I hope this will resolve your issue, if you need any further assistance, feel free to reach out.
Thank you.
Hi tfr111 ,
Thank you for confirming the earlier results. The current calculation only iterates at the customer level, which leads to discrepancies in monthly subtotals when dates are shown in the visual. To resolve this, update the measure to iterate over both the date and customer context using the SUMMARIZE() function. This will ensure that monthly subtotals match the sum of customer rows, yearly totals add up correctly, and the all-time average price stays consistent across all date levels. Use the following DAX:
New Mix Sales (Correct Dates) =
VAR _fixedAvgPrice =
CALCULATE(
DIVIDE(SUM('Data'[Sales]), SUM('Data'[Volume])),
REMOVEFILTERS('Date')
)
RETURN
SUMX(
SUMMARIZE(
'Data',
'Date'[Year],
'Date'[Month Number],
'Data'[Reporting Customer]
),
_fixedAvgPrice * CALCULATE(SUM('Data'[Volume]))
)
I hope this will resolve your issue, if you need any further assistance, feel free to reach out.
Thank you.
Dear Anonymous
thank you very much for the proposal. It worked perfectly!
Best,
tfr