Adding % in Numformat

This might be a simple one — is it possible to add a percentage format (perhaps using "p") in the numformat transform? I know it’s possible to multiply values by 100 manually, but in a pivot transform with many columns or rows, that can become quite cumbersome.

Miguel

So, are you just trying to multiply multiple columns by 100?

I’m not sure it would be appropriate to convert to a percentage in Num Format.

In some cases you can use Scale to convert to a percentage:

Possibly the pivot could output percentages. But would that be the percentage of each row, column or total?

It might be help to see an example of what you are trying to do.

1 Like

I assume you want to change values from 0.34 to 34 (%)?
Multiplying by 100 has the same result, with the advantage of having an output that remains a number and not a text string (34%)

I think the issue is that they need to values in multiple columns by 100. And that is tedious using Calculate.


That’s correct — using CALCULATE is tedious. For example, this is just a utilization value (a percentage).
I was considering using NUMFORMAT, since only the display format needs to be adjusted.

Miguel

but I tried scale and I am getting a different answer.

Miguel

Scale won’t work for what you want to do.

I have come up with 2 fantastically hacky ways to do it. One involving Reshape, which is rather long winded, and the other uses Replace and a regular expression.

See:
multiply.transform (3.6 KB)

Are these values created by a Pivot transform?

And here is a truly revolting hack - use Units to convert Meters to Centimeters. That will multiply everything by 100!

This is good one !!!

1 Like

Here is one way of doing it, you don’t need Replace if the columns are not blank and have 0 in them.

Transform file.
AddingPercentageInNumformat.transform (3.8 KB)

1 Like

If you want to use Scale, you need to ensure that the data contains a 0 and a 1 to scale the minimum and maximum against.

So that gives 4 ways to do + @Anonymous 's method using Gather and Spread.

multiply2.transform (7.4 KB)

Converting to and from percentages doesn’t really fit with any of the existing transforms. But I’m not sure if it is worth a transform on its own. I will give it some thought.

This works very well, thank you!