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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
menphis21
Helper IV
Helper IV

How to create measure with dynamic aggregation and format ?

Hi,

 

Supposed that i have a database with fews variable like : 

variable value 
Total Profit100,687
Investments Profit19,747
Gross Loss Ratio32%
Net Loss Ratio54%

 

 

The variable will be in the filter section and i would like to show depending on the selection the right format on a clustered bar.

In a simple table, it work but not on the graph because of the X axis who stay between 0 and 1.

 

_values4 = SWITCH(
                true(),
                 
                  "Total Profit" in ALLSELECTED('Global'[variable]), [sum_value] ,
                  "Investments Profit" in ALLSELECTED('Global'[variable]), [sum_value] ,
                    "Gross Loss Ratio" in ALLSELECTED('Global'[variable]), [avg_value] )
 
with the
Sum_value = sum('Global'[value]) and 
Avg_value =  average('Global'[value])
 
I tried to change the Avg_value with format function or contatenate but its not working
Avg_value = CONCATENATE( average('Global'[value])*100 , "%")
 
If someone can help 🙂
 
thank you
 

 

5 REPLIES 5
menphis21
Helper IV
Helper IV

Thank you, i dont have the option to create new parameter with fields.

I tried to write the same the code also but its not working. There is another solution ?

 

Thanks

Anonymous
Not applicable

Hi  @menphis21 ,

Whether your problem has been resolved? If yes, could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.

Best Regards

Hi @Anonymous ,

I am still trying to resolve it and the filed paramter didnt permit me to revole it or i dont know how to.

In one field, i have few variable, how can configure that ?

 

variable value 
Total Profit100,687
Investments Profit19,747
Gross Loss Ratio32%
Net Loss Ratio54%

 

Anonymous
Not applicable

Hi @menphis21 ,

What's the version of your Power BI Desktop? You can upgrade to the latest one if it still not be the latest version. Please check if you can find the option "Field parameters"  in Options page...

yingyinr_0-1658481365250.png

Besides that, there are some limitations on using Field parameters, and these can also cause the field parameter to not work properly...

yingyinr_1-1658481574085.png

In addition, you can refer the following links to dynamic

Creating Value Dynamic Formatting using Calculation Groups

Dynamic Formatting of Switch Measures in Power BI

yingyinr_3-1658481891194.png

yingyinr_4-1658481904300.png

Best Regards

amitchandak
Super User
Super User

@menphis21 , if you are using this code in a measure slicer, My advice would be to check if the field parameter can be used

https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors