Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
realMagnusKvale
New Member

Field parameter returning list

Hi y'all 🤠🐮

 

I want to make a slicer for field parameters that returns a list of column names, not one column name per slicer choice (pardon my terminology if it's wrong).

 

The first example below works just fine, but the user can choose 10 x 9 x 8 = 10! combinations of columns, but the only two combinations that actually makes sense are column 1, ... column 5 for either orig or test.. In addition, the choice is sensitive to the order of the slicer choice, which I don't want either...

 

Can this be done? Any solution using bookmarks is not really interesting, that strikes me as terrible engineering, especially from a maintenance perspective 👀

 

Examples:

some_field_parameters = {
    ("Column 1, Orig", NAMEOF('table'[column_1_orig]), 0),
    ("Column 2, Orig", NAMEOF('table'[column_2_orig]), 1),
    ("Column 3, Orig", NAMEOF('table'[column_3_orig]), 2),
    ("Column 4, Orig", NAMEOF('table'[column_4_orig]), 3),
    ("Column 5, Orig", NAMEOF('table'[column_5_orig]), 4),
    ("Column 1, Test", NAMEOF('table'[column_1_test]), 5),
    ("Column 2, Test", NAMEOF('table'[column_2_test]), 6),
    ("Column 3, Test", NAMEOF('table'[column_3_test]), 7),
    ("Column 4, Test", NAMEOF('table'[column_4_test]), 8),
    ("Column 5, Test", NAMEOF('table'[column_5_test]), 9)
}

my_dream_field_parameters {
    ("Orig", (
				NAMEOF('table'[column_1_orig]),
				NAMEOF('table'[column_2_orig]),
				NAMEOF('table'[column_3_orig]),
				NAMEOF('table'[column_4_orig]),
				NAMEOF('table'[column_5_orig])
			), 0),
    ("Test", (
				NAMEOF('table'[column_1_test]),
				NAMEOF('table'[column_2_test]),
				NAMEOF('table'[column_3_test]),
				NAMEOF('table'[column_4_test]),
				NAMEOF('table'[column_5_test])
			), 1)
}

 

1 ACCEPTED SOLUTION
Sergii24
Super User
Super User

Hi @realMagnusKvale, you can enrich the field parameter code with extra columns to group values:

Parameter New = {
    ("column_1_orig", NAMEOF('table'[column_1_orig]), 0, "Orig"),
    ("column_2_orig", NAMEOF('table'[column_2_orig]), 1, "Orig"),
    ("column_3_orig", NAMEOF('table'[column_3_orig]), 2, "Orig"),
    ("column_4_orig", NAMEOF('table'[column_4_orig]), 3, "Orig"),
    ("column_5_orig", NAMEOF('table'[column_5_orig]), 4, "Orig"),
    ("column_1_test", NAMEOF('table'[column_1_test]), 5, "Test"),
    ("column_2_test", NAMEOF('table'[column_2_test]), 6, "Test"),
    ("column_3_test", NAMEOF('table'[column_3_test]), 7, "Test"),
    ("column_4_test", NAMEOF('table'[column_4_test]), 8, "Test"),
    ("column_5_test", NAMEOF('table'[column_5_test]), 9, "Test")
}

Now, you can create a hierarchy like in the Option #1. However, it doesn't block a user from selecting some items from different groups. What you can do is to apply the Option #2 where you use 2 separate slicers: the first one forces a user to select "Orig" or "Test" group and then the second one allows to select the items. Important: the second slicer should not filter the first one (check iteraction b/w items)

Sergii24_0-1768947641367.png

I'm attaching pbix.

Good luck with your project! 🙂

 

View solution in original post

3 REPLIES 3
Sergii24
Super User
Super User

Hi @realMagnusKvale, you can enrich the field parameter code with extra columns to group values:

Parameter New = {
    ("column_1_orig", NAMEOF('table'[column_1_orig]), 0, "Orig"),
    ("column_2_orig", NAMEOF('table'[column_2_orig]), 1, "Orig"),
    ("column_3_orig", NAMEOF('table'[column_3_orig]), 2, "Orig"),
    ("column_4_orig", NAMEOF('table'[column_4_orig]), 3, "Orig"),
    ("column_5_orig", NAMEOF('table'[column_5_orig]), 4, "Orig"),
    ("column_1_test", NAMEOF('table'[column_1_test]), 5, "Test"),
    ("column_2_test", NAMEOF('table'[column_2_test]), 6, "Test"),
    ("column_3_test", NAMEOF('table'[column_3_test]), 7, "Test"),
    ("column_4_test", NAMEOF('table'[column_4_test]), 8, "Test"),
    ("column_5_test", NAMEOF('table'[column_5_test]), 9, "Test")
}

Now, you can create a hierarchy like in the Option #1. However, it doesn't block a user from selecting some items from different groups. What you can do is to apply the Option #2 where you use 2 separate slicers: the first one forces a user to select "Orig" or "Test" group and then the second one allows to select the items. Important: the second slicer should not filter the first one (check iteraction b/w items)

Sergii24_0-1768947641367.png

I'm attaching pbix.

Good luck with your project! 🙂

 

danextian
Super User
Super User

Hi @realMagnusKvale 

Can you please explain this?

 combinations of columns, but the only two combinations that actually makes sense are column 1, ... column 5 for either orig or test.. In addition, the choice is sensitive to the order of the slicer choice, which I don't want either...

Also, Power BI does not preserve the order in which selections are made. The column order is determined by the order column in the field parameter.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian, yes:

 

1.

In the first example, the user can choose e.g. Column 1, Orig and Column 3, Test. In my case, that's a non sensical choice. I'd like to force the user to make one of two choices, "Orig" or "Test", each of which returns a list of five column names.

 

2.

I just checked, and wheter I choose 5, 3, ..., 1 or 1, 2, ..., 5 makes a difference: The matrix and bar chart that use the field parameters in question depend on the order of the choice made by the user, I can see it happen.. I'd like that not to be the case.. I could consider taking a screenshot, but I'd have to remove a lot of information, so I don't share anything that I'm not supposed to.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors