Forum Discussion
Flip columns values (strings - dimensions/rows (Rows section in matrix)) based on parameter
I want to flip the column values based on parameter selection. For example I have two columns First Name and Last Name.
Parameter Values -->
First, Last
Last, First
First, Last Option:
First Name || Last Name
Last, First Option:
Last Name || First Name
Add extra rows to your field paramter table and another column to group the rows into
NamesParameter = { ( "FirstName", NAMEOF ( 'Names'[FirstName] ), 0, "First, Last" ), ( "LastName", NAMEOF ( 'Names'[LastName] ), 1, "First, Last" ), ( "FirstName", NAMEOF ( 'Names'[FirstName] ), 3, "Last, First" ), ( "LastName", NAMEOF ( 'Names'[LastName] ), 2, "Last, First" ) }The order column determines their display order.
15 Replies
- ninja18Helper I
I believe we have to create two field parameters (one for each column). Any possibility to control these two field parameters with another parameter, rather than displaying two parameters on screen?
- danextianSuper User
If you wanted to just show a combination of first and last or last and first, you would only need two columns for that and a single field parameter. Or are you trying to display two different columns at the same time?
- Shubham_rai955Super User
Use a field parameter (or a simple DAX column if you only need a concatenated full name).
Option 1 – concatenated column (easiest)
Create a column in your dimension table:
Full Name := VAR FirstLast = 'DimPeople'[First Name] & " " & 'DimPeople'[Last Name] VAR LastFirst = 'DimPeople'[Last Name] & " " & 'DimPeople'[First Name] RETURN SWITCH ( SELECTEDVALUE ( 'Name Order Parm'[Order] ), "First, Last", FirstLast, "Last, First", LastFirst, FirstLast )Name Order Parm is a disconnected table with values "First, Last" and "Last, First" used as a slicer.
Use Full Name on Rows of your matrix; changing the slicer flips the order.Option 2 – field parameter for separate columns
If you truly need two separate columns, create a field parameter containing [First Name] and [Last Name], then duplicate it and use techniques for dynamic hierarchies so the parameter’s order depends on a small “Order” table controlled by a slicer.
- ninja18Helper I
Thank you, Shubham !
Can you eloborate the option 2 please?
- SavioFerrazSuper User
Hi Shubham_rai955 ,
Your suggestion is on the right track, and the key point is choosing the simplest solution that actually fits the requirement.
Let me clarify and slightly refine it.
✅ Option 1 – Concatenated column (recommended in most cases)
If the requirement is only about display order (First Last vs Last First), then a single concatenated column is absolutely the best and cleanest solution.
However, one important correction:
A calculated column cannot react to a slicer.
So this logic should be implemented as a measure, not a column.
Correct approach (measure)
Full Name :=
VAR FirstLast =
SELECTEDVALUE ( 'DimPeople'[First Name] ) & " " &
SELECTEDVALUE ( 'DimPeople'[Last Name] )
VAR LastFirst =
SELECTEDVALUE ( 'DimPeople'[Last Name] ) & " " &
SELECTEDVALUE ( 'DimPeople'[First Name] )
RETURN
SWITCH (
SELECTEDVALUE ( 'Name Order Parm'[Order], "First, Last" ),
"First, Last", FirstLast,
"Last, First", LastFirst
)
Name Order Parm is a disconnected table used as a slicerUse Full Name (measure) in a table or matrix
Changing the slicer flips the display order instantly
✔ Simple
✔ Performant
✔ Easy to maintain⚠ Option 2 – Field parameter (only if you truly need separate columns)
If you genuinely need:
First Name and Last Name as separate fields
And want to change their order dynamically
Then a Field Parameter can work — but it is more complex and harder to maintain.
This approach:
Requires duplicating the parameter
Needs a helper “Order” table
Uses dynamic hierarchy tricks
It’s valid, but overkill unless you really need column-level control.
🧠 Recommendation
99% of cases → use Option 1 (measure-based concatenated name)
Only use field parameters if the business explicitly requires:
separate columns
dynamic reordering of those columns
Conceptual illustration
Slicer: Name Order
[ First, Last ] [ Last, First ]Matrix:
┌───────────────────────┐
│ John Smith │ ← First, Last
│ Smith John │ ← Last, First
└───────────────────────┘
Thanks for sharing the idea — it’s a good one 👍
If this clarification helps, please consider giving a kudos
And if it answers the question fully, feel free to mark it as the Accepted Answer ✔- ninja18Helper I
I took sample data as first name and last name. Actual data is different, so I would need two columns, rather than concatenated one. If you can eloborate Shubham's option 2 that would be great.