Forum Discussion
Field Parameter Hierarchy
Hi,
I currently have a simple field parameter to switch matrix rows against a slicer which works fine.
Is it possible that on selecting one of the slicer options that you can display a sort of hierarchy in the matrix e.g. 2 fields, and then the other slicer option just uses one field like currently.
E.G one option for the matrix is country and city and the other option is just user. This then toggles against the country/city or user.
Thanks
Hi oussamahaimoud, DanieleUgoCopp
Thankyou so much for your really insightful replies.
I ended up finding a way to simply create a calculated column within the field parameter which grouped it e.g. calling country and city geography, and then using that column as the slicer which toggled the matrix as a hierarchy.
Thanks
3 Replies
- DanieleUgoCoppSuper User
Hello,
I don't think a standard field parameter can dynamically switch between a single field and a multi-level hierarchy in the same parameter, one approach could be to create a hierarchy (Country > City) and include that as a separate option in the field parameter, then have User as another option.
Alternatively, you could use separate visuals and toggle their visibility based on the slicer selection.Best regards,
Daniele- lherbert501Post Prodigy
Hi oussamahaimoud, DanieleUgoCopp
Thankyou so much for your really insightful replies.
I ended up finding a way to simply create a calculated column within the field parameter which grouped it e.g. calling country and city geography, and then using that column as the slicer which toggled the matrix as a hierarchy.
Thanks
- oussamahaimoudMemorable Member
Hi lherbert501,
I agree with DanieleUgoCopp and I want just to add my perception that can helps you.
The native Field Parameter doesn't support conditional hierarchies out of the box, but you can simulate a 2-level hierarchy dynamically by adding a dedicated "grouping" column to your parameter and controlling visibility via measures. So, the best practice most robust pattern uses two parameters and a What-If slicer to toggle between them.
1. Create your Field Parameter normally
Include all fields you want selectable:
Country
City
User
2. Add a dedicated "View" selector table
Create a simple calculated table:
ViewSelector =
DATATABLE("View", STRING, "ViewOrder", INTEGER,
{{"Location (Country / City)", 1}, {"User", 2}}
)
Expose [View] as your slicer.
3. Use two row fields in the matrix, control visibility via a measure
Place both Country and City in the matrix rows (as a natural hierarchy), then add User below them.
Use this measure to blank out irrelevant rows:
VisibilityFilter =
VAR _selectedView = SELECTEDVALUE(ViewSelector[View])
VAR _isLocationView = _selectedView = "Location (Country / City)"
RETURN
IF(
ISINSCOPE(User[User]),
IF(NOT _isLocationView, 1, BLANK()),
IF(_isLocationView, 1, BLANK())
)
Add this measure as a visual-level filter on the matrix: VisibilityFilter = 1.
Remember that :
- The ISINSCOPE check ensures subtotal rows at Country level are handled correctly, so Country totals won't disappear when City is scoped
- If you need measures to react to the selection too (e.g. different KPIs per view), wrap the same SELECTEDVALUE(ViewSelector[View]) logic inside your measure as well
Assisted by AI for clarty of wording!
- The ISINSCOPE check ensures subtotal rows at Country level are handled correctly, so Country totals won't disappear when City is scoped