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

Expression that converts Megabytes values into Gigabytes based on size?

Hi

I have a table of data like this:

IDFile Size (MB)
rterweeer0.15
gfgjfgdf55.2
eeeeeeree800.67
dvvfgfhfgfgg7500.34
rtrtrtrtrtrthtytytyty34.3
fdfdfd45089.45
  

 

Is there an expresison that converts File Size (MB) into GB?

Imagine a KPI object where it aggregates by Sum([File Size (MB)]).

I want the output of the KPI to be displayed something like:

Where the total size is <1GB then it should display it with MB (e.g. "123 MB" or "760 MB" etc).

And when the total is >1GB then display it with GB (e.g. "15 GB" or "300 GB" etc).

Any idea how to do this?

2 Replies
forte
Partner - Creator
Partner - Creator

Hi @jblomqvist 

You can try something like this

=num(vMyExpression / if(vMyExpression < 1000,1,1000), if(vMyExpression < 1000, '#.##0 Mb','#.##0,0 Gb'))

Hope it helps

Regards

marcus_sommer

You may use something like that with 1000 as divisor-basis:

num(sum(FileSize) / pow(10, pick(ceil(len(sum(FileSize))/3), 0, 1, 2, 3) * 3),
   '#.##0,0 ' & pick(ceil(len(sum(FileSize))/3), '', 'K', 'M', 'G') & 'Byte')

or a bit adjusted with 1024 as divisor-basis:

= num(sum(FileSize) / pow(1024, pick(ceil(len(sum(FileSize))/3), 0, 1, 2, 3)), '#.##0,0 ' & pick(ceil(len(sum(FileSize))/3), '', 'K', 'M', 'G') & 'Byte')

- Marcus