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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

Anonymous
Not applicable

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors