Forum Discussion
Override Slicer for 1 Column in Matrix
Hello,
I've tried to google/search the subject of this post - haven't found what I'm looking for.
If I missed it and someone has a link, please share!
I have a slicer at the top of my page:
I want the slicer to act on every column in my matrix except one:
| Location | Number1Oct20 | Number2Oct20 | Number3Oct20 | Number3Apr21 |
| North | 14 | -3 | -2 | |
| South | 23 | -0.5 | -0.50 | |
| East | 12 | -1.30 | -1.10 | |
| West | 8 | -0.09 | 0.00 |
Number3Apr - is supposed to be the furthest "future" number we have available in the system.
Without the Slicer on the page, I would have written a Dax Measure as follows:
Calculate (sum (Table1[Number3]), Filter(Table1, Table1[Date] = Max (Table1[Date])))
This almost gets me there:
Calculate(
Sum (Table1[Number3]),
All (Table1),
Filter(Table1, Table1[Date] = Max (Table1[Date]))
)
But it takes away the Row Context (ie same number for every location).
Is there any way to write it and get the Location Context?
Appreciate any help or advice. TYIA.
- Anonymous5 years ago
Hi Anonymous
Try this code.
Number3 Apr21 = VAR _MaxDate = MAXX ( FILTER ( ALL ( Table1 ), Table1[Location] = MAX ( Table1[Location] ) ), Table1[Date] ) RETURN CALCULATE ( SUM ( Table1[Number3] ), FILTER ( ALL ( Table1 ), AND ( Table1[Date] = _MaxDate, Table1[Location] = MAX ( Table1[Location] ) ) ) )My Sample looks like below.
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
8 Replies
- AnonymousNot applicable
Anonymous Try ALLEXCEPT(Table1,Table1[Location])
- AnonymousNot applicable
Calculate(
Sum (Table1[Number3]),
AllExcept (Table1,Table1[Location]),
Filter(Table1, Table1[Date] = Max (Table1[Date]))
)Result did not change, still no row context.
- AnonymousNot applicable
parry2k any ideas?
- AnonymousNot applicable
amitchandak, Greg_Deckler hm could you weigh in? a link or any small direction?
- AnonymousNot applicable
Calculate(
Sum (Table1[Number3]),
Filter( AllExcept (Table1,Table1[Location]), Table1[Date] = Max (Table1[Date]))
)- AnonymousNot applicable
Anonymous Sorry, these don't work. same number for every location.
- parry2k
Super User
Anonymous not sure if I understood what you are trying to achieve. It will be easier if you share pbix file with the expected output and let's go from there. Remove sensitive information before sharing. You can share using onedrive/google drive
- AnonymousNot applicable
Hi Anonymous
Try this code.
Number3 Apr21 = VAR _MaxDate = MAXX ( FILTER ( ALL ( Table1 ), Table1[Location] = MAX ( Table1[Location] ) ), Table1[Date] ) RETURN CALCULATE ( SUM ( Table1[Number3] ), FILTER ( ALL ( Table1 ), AND ( Table1[Date] = _MaxDate, Table1[Location] = MAX ( Table1[Location] ) ) ) )My Sample looks like below.
Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.