Need a special offer?Find out if your project fits.
+

Hide column which has 0 or null value and show if there is a value

Answered
Mohamed asked on September 21, 2021

Hi 
I am working with some data and have a column which has values but some instance it doesn't have values at all and total would be "0".
How can I hide such column? Please see sample code below and screen capture attached.

mapping: {
"Category": {
isMeasure: true,
caption: "Staffed"
},
"StaffRequired": {
isMeasure: true,
caption: "Required"
},
}

Attachments:
required.PNG

3 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 22, 2021

Hello,
 
Thank you for posting on our forum.
 
We suggest developing a function that would scan members of each measure selected to the report. This function should check if at least one of the members differs from zero/null. Finally, filter out unwanted hierarchies from the slice.
 
Here is the JSFiddle we prepared for your reference: https://jsfiddle.net/flexmonster/3rq6somh/.
 
Please note that this approach only works for numeric fields and should not be used for fields of the other data types (for example, string field with count aggregation).
 
Please let us know if it works for you.
Looking forward to your feedback.
 
Regards,
Illia

Public
Mohamed September 23, 2021

Hi Illia
this solution only work if we have one single column, if we have multiple columns this solution hide all the column regardless of value 0.
Please advice.
Thanks

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 24, 2021

Hello,
 
Could you please modify the provided JSFiddle to demonstrate this behavior?
 
Looking forward to hearing from you.
 
Regards,
Illia

Please login or Register to Submit Answer