cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
ravib
Frequent Visitor

Field Parameters not working for any visual

Hi team, just signed up on this forum. Excited to be here!

I'm trying to use field parameters to choose between metrics I want to display. I know its pretty straightforward since I watched a bunch of youtube videos and read through the MS documentation on how to set it up.

While the field parameter setup works for a table visual (choose a dimension and the field parameter and toggle between the choices to display the chosen metric), I am not able to see the same behavior in ANY of the other visuals....bar chart, pie chart, line chart...anything.

Previously, I was using DirectQuery and I thought field parameters might not work for DirectQuery, but it doesnt work even if I import the data. I have upgraded my desktop to the latest version (Jun 14, 2022), but still nothing.

I don't know if anybody else has encountered this wierd situation. If so, any ideas ?

 

I've attached a PBIX file simple to show you with a simple dataset, how field parameter works for the table, and not for the bar chart.

https://github.com/ravib22/powerbi/blob/main/Test-FieldParam.pbix 

Any hints would be greatly appreciated!!

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @ravib ;

Since the newly generated field parameter Choose Metrics is a text type, the Y-axis requirement in the bar graph is value, which is the number type, so blank will be displayed here.

vyalanwumsft_0-1655973091035.png

vyalanwumsft_1-1655973111215.png
Therefore, the following schemes can be used:

1.create a new table.

Newtable = {
    "UnitsInStock",
    "UnitsOnOrder"}

2.create a measure.

Measure = SWITCH(MAX('Newtable'[Value]),"UnitsInStock",SUM(Products[UnitsInStock]), "UnitsOnOrder",SUM(Products[UnitsOnOrder]))

The final show:

vyalanwumsft_2-1655973195073.pngvyalanwumsft_3-1655973200505.png

vyalanwumsft_4-1655973206480.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yalanwu-msft
Community Support
Community Support

Hi, @ravib ;

Since the newly generated field parameter Choose Metrics is a text type, the Y-axis requirement in the bar graph is value, which is the number type, so blank will be displayed here.

vyalanwumsft_0-1655973091035.png

vyalanwumsft_1-1655973111215.png
Therefore, the following schemes can be used:

1.create a new table.

Newtable = {
    "UnitsInStock",
    "UnitsOnOrder"}

2.create a measure.

Measure = SWITCH(MAX('Newtable'[Value]),"UnitsInStock",SUM(Products[UnitsInStock]), "UnitsOnOrder",SUM(Products[UnitsOnOrder]))

The final show:

vyalanwumsft_2-1655973195073.pngvyalanwumsft_3-1655973200505.png

vyalanwumsft_4-1655973206480.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for taking the time to reply to my question @v-yalanwu-msft . This is awesome.

Another way of doing this is to just create two new measures and add them to the field parameter.

MeasureUIS = SUM(Products[UnitsInStock])

MeasureUIO = SUM(Products[UnitsOnOrder])

This also worked for me.

 

Thanks all for taking interest in answering this q.

ravib

Ya, this is Working like a Magic !!

ravib
Frequent Visitor

Hi @amitchandak , thanks for your reply. But if we do that, then we get a UnitsOnOrder by Count of category name, instead of UnitsOnOrder by CategoryName. The expected outcome is UnitsOnOrder by CategoryName or UnitsInStock by CategoryName. Hope it clarifies.

Thanks.

amitchandak
Super User
Super User

@ravib , choose metrics should be on the y-Axis

 

amitchandak_0-1655356344438.png

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors