Reporting

Treating comma separated values as numbers in Pivot data model attribute definition

gregbujak
Path Finder

This question is specific to the new Pivot functionality in Splunk 6.

I have built up my data model, defined all the attributes and am ready to crunch my data.
However, I have a field/attribute (notional) that is a numeric field with comma formatting (ex. 1,000,000).

What is the process for eliminating the comma so that I can properly define it as a number?

I understand how to do this in regular search but cant figure out the secret sauce for pivot.

Thanks

0 Karma

Simon_Fishel
Splunk Employee
Splunk Employee

In the data model editor, you should be able to define an Eval attribute and do whatever you would do in regular search.

gregbujak
Path Finder

You are correct in a very general way.
Following:
http://answers.splunk.com/answers/36792/how-to-sum-numbers-with-commas
Using rex: "(?.)" | convert rmcomma(stripped_notional)
The result was empty.
Using rex: setting field to notional
"(?.
)"| rex field=stripped_notional mode=sed "s/,//g"
Caused a parse error in "//g"

Using eval: setting field to stripped_notional and then the eval expression: replace(notional, ",", "")
finally worked.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...