Forum Discussion
Filter
- 1 year ago
Hi swalke,
Thank you for reaching out to the Microsoft fabric community forum.
As per your requirement, the final solution shows sales for all previous quarters regardless of the slicer, and only current quarter sales filtered by selected dates using a disconnected quarter table and a smart DAX measure. The matrix now accurately displays quarters in rows and categories in columns with correct values.
I tested it with my sample data, and it worked fine. Please find the attached screenshot and Pbix for your reference.Hope this helps if you have any queries we are happy to assist you further.
Best Regards,
Harshitha.
Hi swalke ,
This is a tricky one but I've got you covered. You need a measure that treats past quarters and current quarter differently.
Here's the solution:
Sales Measure =
VAR CurrentQuarter =
CALCULATE(
MAX('Calendar'[Quarter]),
REMOVEFILTERS()
)
VAR SelectedQuarter = MAX('Calendar'[Quarter])
VAR IsCurrentQuarter = SelectedQuarter = CurrentQuarter
RETURN
IF(
IsCurrentQuarter,
-- Current quarter: respect date slicer
SUM('Sales'[Amount]),
-- Previous quarters: ignore date slicer
CALCULATE(
SUM('Sales'[Amount]),
REMOVEFILTERS('Calendar'[Date])
)
)How this works:
- For previous quarters (Q1-25, Q2-25, etc.): Uses REMOVEFILTERS to ignore the date slicer completely
- For current quarter: Respects the date range selected in your slicer
- The matrix will show all quarters but only the current one will be affected by date selections
Alternative if you have a current quarter flag:
Sales Measure =
IF(
MAX('Table'[IsCurrentQuarter]) = 1,
SUM('Sales'[Amount]),
CALCULATE(
SUM('Sales'[Amount]),
REMOVEFILTERS('Calendar'[Date])
)
)Put this measure in your matrix with Quarter and Category, and it'll behave exactly like you described. Past quarters stay fixed, current quarter responds to your date slicer.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.
- swalke1 year agoFrequent Visitor
Thank you for responding,
I tried both version of the DAX provided by you but it is not fullfilling my need. The matrix visual is showing sales for only current quarter and previous quarter data is not visible in the matrix. - swalke1 year agoFrequent Visitor
Hi,
Thank you for your quick response,
unfortuantely the measure provided by you is not fulfilling my need. The measure is not able to show previous quarters in the measure.