Forum Discussion
Flip columns values (strings - dimensions/rows (Rows section in matrix)) based on parameter
- 9 months ago
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.
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 slicer
Use 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 ✔
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.
- SavioFerraz9 months ago
Super User
Hi ninja18,
Thanks for the clarification — that helps a lot 👍
If you truly need two separate columns (not a concatenated display), then Shubham’s Option 2 using Field Parameters is the correct direction. Let me walk through it in a practical way.✅ Goal recap
You want:
Two separate columns (e.g. First Name and Last Name)
The order of those columns to change based on a slicer:
First Name | Last Name
Last Name | First Name
This cannot be done with a calculated column or a simple measure alone — Field Parameters are required.
Step 1 – Create the Name Order slicer table (disconnected)
Create a small table:
Name Order =
DATATABLE (
"Order", STRING,
{
{ "First, Last" },
{ "Last, First" }
}
)
Use this table as a slicer.Step 2 – Create TWO field parameters
Parameter 1 – First NameCreate a field parameter containing only:
DimPeople[First Name]
Parameter 2 – Last Name
Create another field parameter containing only:
DimPeople[Last Name]
Power BI will generate tables similar to:
FirstName_Param
LastName_ParamStep 3 – Create a dynamic column order measure
Now create a helper measure to control visibility/order:
Show First Name :=
IF (
SELECTEDVALUE ( 'Name Order'[Order] ) = "First, Last",
1,
2
)Show Last Name :=
IF (
SELECTEDVALUE ( 'Name Order'[Order] ) = "Last, First",
1,
2
)Step 4 – Build the matrix visual
Add both field parameters to the Columns area
Sort the parameters by the corresponding measure:
First Name parameter → Show First Name
Last Name parameter → Show Last Name
Use the Name Order slicer to control the order
Power BI will reorder the columns dynamically.
Result
First Name Last Nameor
Last Name First Name
based on slicer selection — without concatenation.
⚠ Important notes
This works only in tables/matrices
It adds some complexity to the model
Maintenance is higher than the concatenated approach
But it is the only supported way to dynamically reorder separate columns
Conceptual illustration
Slicer:
[ First, Last ] [ Last, First ]Matrix:
┌───────────────┐
│ First Name | Last Name │
└───────────────┘OR
┌───────────────┐
│ Last Name | First Name │
└───────────────┘
Thanks for the follow-up — this is a great use case for field parameters 👍
If this explanation helps, please consider giving it a kudos
And if it answers your question, feel free to mark it as the Accepted Answer ✔- ninja189 months ago
Helper I
Hi SavioFerraz
I have tried creating everything by following your instructions, but it is not working.
- danextian9 months ago
Super User
It feels like their replies are AI generated.