Forum Discussion
Replace 0 with string
Hi all,
How can I replace 0 with string value in a bar chart ?
I create a measure to display "Error" when average = 0 but only work in a table
Measure =
var AVG =
AVERAGEX(
SUMMARIZE(
table;table[name];
"@avg_by_name";
AVERAGE(
table[amount]
)
);
[@avg_by_name]
)
return
if ( AVG = 0; "Error"; AVG )
Thank you
This work for me in table not in bar chart even if you add measure with tabular editor. Hope it will help
Measure = var AVG = AVERAGEX( SUMMARIZE( table;table[name]; "@avg_by_name"; AVERAGE( table[amount] ) ); [@avg_by_name] ) return if ( AVG = 0; "Error"; AVG )
5 Replies
- amitchandakSuper User
freginier , if you want to display an error, it should become a text measure. Post that I doubt you can use that on bar visual
may be dynamic label using calculation group an help
https://www.linkedin.com/pulse/dynamic-chart-labels-calculation-groups-kane-snyder
- freginierSolution Sage
amitchandak it's functional error not a real error.
I would like a bar chart with average measure (display the average) and when the average it's zero then replace 0 with "error" or "N/A"
Do you think it's possible ?
I tried your link but unfortunately that doesn't work for me..
- freginierSolution Sage
amitchandak any idea ? 🙂
- v-xiaotangCommunity Support
Hi freginier
Actually, that's not supported in bar chart,
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- freginierSolution Sage
This work for me in table not in bar chart even if you add measure with tabular editor. Hope it will help
Measure = var AVG = AVERAGEX( SUMMARIZE( table;table[name]; "@avg_by_name"; AVERAGE( table[amount] ) ); [@avg_by_name] ) return if ( AVG = 0; "Error"; AVG )