Forum Discussion
Two measures with diffrent slicer selection for same column
- 5 months ago
Hi sanjaymithran , Thank you for reaching out to the Microsoft Community Forum.
Yes, switching to TREATAS will perform better. TREATAS applies a proper column filter (like a virtual relationship), which allows the Storage Engine to handle the filtering efficiently instead of iterating the whole table in the Formula Engine.
Rewrite your measure like this:
Sales1 =
CALCULATE(
SUM(Data[sales]),
TREATAS(VALUES(Slicer1[Quarter]), Data[Quarter]),
Data[ProdGroup] = "Term",
Data[Type] = "Actual"
)
You can solve this by using two disconnected slicer tables and the TREATAS function. Each slicer needs its own table so that it only controls one measure.
Steps:
- Create two slicer tables (no relationships to your fact table):
Slicer1 = DISTINCT(SELECTCOLUMNS(Data, "Quarter", Data[Slicer1]))
Slicer2 = DISTINCT(SELECTCOLUMNS(Data, "Quarter", Data[Slicer2]))
- Write measures that apply each slicer separately:
Sales1 =
CALCULATE(
SUM(Data[sales]),
TREATAS(VALUES(Slicer1[Quarter]), Data[Slicer1])
)
Sales2 =
CALCULATE(
SUM(Data[sales]),
TREATAS(VALUES(Slicer2[Quarter]), Data[Slicer2])
)
- Put dim1 on rows and add both measures to your table visual.
Now Slicer1 will only affect Sales1, and Slicer2 will only affect Sales2.
Example:
- Slicer1 = Q1 2025, Slicer2 = Q2 2025 → dv1 shows 6 vs 8
- Slicer1 = Q1 2025, Slicer2 = Q4 2025 → dv1 shows 6 vs 0, dv2 shows 0 vs 16
That should give you the exact results you were expecting.