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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
H3nning
Helper V
Helper V

One Slicer, multiple Parameters

Hi,

I already found a few topics about this and they have accepted solutions, but I just dont get it yet. Maybe its because Im not really sure how the field parameter syntax works.

 

I have two sets of measures im my model. To keep it simple its 4 in total.

Sales measure 1

Sales measure 2

Revenue measure 1

Revenue measure 2

 

What i want to do is, I want to show the two sales measures or the two revenue measures in a stacked bar chart, but one at a time depending on one slicer. So only the sales measures OR the revenue measures.

 

In my understanding this can be done by expanding field parameters somehow, but it did not work.

 

Parameter = {
    ("Sales", NAMEOF([Sales measure 1]), 0,"Sales"),
    ("Revenue", NAMEOF([Revenue measure 1]), 1,"Revenue"),

    ("Sales", NAMEOF([Sales measure 2]), 3,"Sales"),

    ("Revenue", NAMEOF([Revenue measure 2]), 4,"Revenue")

 

This resultet in a new colum value 4 and i dont know why. Can anyone explain how this works?

 

Thank you so much!

1 ACCEPTED SOLUTION

I think I got your issue now.my last try.check this

PBIViz_2024_0-1726070955411.pngPBIViz_2024_1-1726070974581.pngPBIViz_2024_2-1726070976097.pngPBIViz_2024_3-1726070989993.pngPBIViz_2024_4-1726071003942.png

You have to bring value4 to fields for the slicer and for the y axis of the graph do below,

PBIViz_2024_5-1726071180583.png

I hope this works

regards,

View solution in original post

9 REPLIES 9
PBIViz_2024
Advocate I
Advocate I

Hi,

I believe you have manually written this to generate a field parameter.Here is how you should do it.

 

Go to Modeling Tab->New Parameter->Field

Then do as below screenshot,

PBIViz_2024_0-1726067495060.png

Then Click on "Create" Button.Your field parameter will be available to use and it will automatically generate the slicer also.

 

PBIViz_2024_1-1726067583916.png

correct syntax for the field parameter is shown below.But do not write it manually instead follow the above steps.

PBIViz_2024_2-1726067614597.png

 

But this will only make it possible to switch between the 2 sales measures. I want to display BOTH sales measures or BOTH revenue measures in a stacked bar chart for example.

Hi,

For that first create the Field parameter with all 4 measures as explained before.

That will result a slicer looks like below,

PBIViz_2024_0-1726068668356.png

and then in slicer settings disable mutli selction with Ctrl

PBIViz_2024_1-1726068723843.png

you will be able to easily select whatever the measure/measures you want.

 

PBIViz_2024_0-1726069258523.png

 

No that wont do it either Im afraid. But thank you so far anyway. In the end it want a slice with 2 options "Revenue" and "Sales". When I select Sale my barchart shows the two sales measures and when I select Revenue its the 2 revenue measures. 

My example with 4 measures is just to simplify. In reality I have 6 or 8 measures per option and I dont want the user to be able to mix them or to be obliged to select each one, one by one...

I think I got your issue now.my last try.check this

PBIViz_2024_0-1726070955411.pngPBIViz_2024_1-1726070974581.pngPBIViz_2024_2-1726070976097.pngPBIViz_2024_3-1726070989993.pngPBIViz_2024_4-1726071003942.png

You have to bring value4 to fields for the slicer and for the y axis of the graph do below,

PBIViz_2024_5-1726071180583.png

I hope this works

regards,

All visuals are empty... This is my code with real fields:

TestOneSlicer = {
    ("GewichteterRestBetrag0-30", NAMEOF('Measures (2)'[__GewichteterRestBetrag0-30]), 0,"Revenue"),
    ("GewichteterRestBetrag31-60", NAMEOF([__GewichteterRestBetrag31-60]), 1, "Revenue"),
    ("GewichteterRestBetrag61-90", NAMEOF([__GewichteterRestBetrag61-90]), 2, "Sales"),
    ("GewichteterRestBetragGr90", NAMEOF([__GewichteterRestBetragGr90]), 3, "Sales")
    }
 
But value 4 in slicer results in an empty slicer:
H3nning_0-1726074072238.png

 

Why???

Hi,

It is hard to tell without looking at it.please check my test pbix.test .this is how it should come,

 

PBIViz_2024_0-1726103859086.png

 

 

regards,

 

Thank you, but maybe stupid question: How am I supposed to open that? When I click it I get to a folder somewhere, but there is no pbix...

There are no direct syntax errors in my code though, rigth?

Ok, I found my mistake. Works now. Thanks a lot!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.