Transformation text to number

Hi,
I picked up a script for a
calculated column.
In one column, I have the values ​​of
disk space used in "text" format.
They can be in MB, GB OR
TB. The counts have a
point of separation. Ex: 15.6 GB
In my column calculated, I want to
get the result in Go AND with
commas. When I apply the script, I end up with
the same value without the indication
text and with the point. (ex: 15.6)
and the format remains text, excluding
the result I want is 15.6 (decimal
or integer if I want)
I put the scripts, if anyone can help
me.  thank you.
= if (if (iserror (find ("KB"
[used space])), FALSE,
TRUE); "0" if (if (iserror
(find ("MB" [used
space])); FALSE; TRUE);
Concatenate ("0;"
SUBSTITUTE (SUBSTITUTE ([used space],
"MB", "");
if (if (iserror (find ("TB"
[used space])), FALSE,
TRUE); SUBSTITUTE (SUBSTITUTE ([used
space], "TB",
"0"), "", "");
SUBSTITUTE (SUBSTITUTE ([used space]
"GB"; "")"

Right! I've been playing with the workbook for a while and have found that the model is failing to recognise numbers stored as text as actual numbers even when the VALUE function is used. As a result, I have written logic that will manually break down the
text and then reconstruct it as a number.
We shouldn't normally require a solution anywhere near this complicated for the given scenario but due to what appears to be a character glitch/bug in the model there appears to be no easy way to convert the text into a number. The DAX formula below is
quite complex compared to the one originally proposed - I have already added this column in the OneDrive copy ;)
=
SUBSTITUTE(
SWITCH(
RIGHT('synthese-serveur'[used space], 2),
"MB",
VALUE(
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
1
+
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
2
)/100
)/1000,
"GB",
VALUE(
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
1
+
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
2
)/100
"TB",
VALUE(
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
1
+
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
2
)/100
)* 1000
If this is working as expected, let me know and I will provide an explanation of what is happening in the DAX formula.
Edit: To minimize the replication of DAX code, you can go for a two column solution where [used space Go Part 1] is defined as:
=VALUE(
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
1
+
PATHITEM(
SUBSTITUTE(
PATHITEM(
SUBSTITUTE(
'synthese-serveur'[used space],
"|"
1
"|"
2
)/100
And [used space Go Part 2] is defined as:
=SUBSTITUTE(
SWITCH(
RIGHT('synthese-serveur'[used space], 2),
"MB", 'synthese-serveur'[used space Go Part 1] / 1000,
"GB", 'synthese-serveur'[used space Go Part 1],
"TB", 'synthese-serveur'[used space Go Part 1] * 1000
The main concern with this approach is that it will result in a larger model/file size due to the relatively high number of distinct values in the columns.
Regards,
Michael
Please remember to mark a post that answers your question as an answer...If a post doesn't answer your question but you've found it helpful, please remember to vote it as helpful :)
Website: nimblelearn.com, Blog:
nimblelearn.com/blog, Twitter:
@nimblelearn

Similar Messages

  • Database error text: invalid number

    Hi Gurus,
    I am calling a procedure proxy from ECC and it is giving me a short dump:
    Error 339 has occurred while executing database procedure
      ""_SYS_BIC"."Krishna_Demo_Proj.Model/KC_GET_MARA"" on the
    current database connection "R/3".
    Database error text: invalid number: ''
    Triggering statement: "dsql_open_proc"
    I have created a table with only one field.
    Mapped the Data types after creating the Procedure Proxy
    Which data type I need to use? I tried with lots of combinations but, still the same error.
    Regards,
    Krishna Chauhan

    Hi Srinu,
    I have used NVARCHAR 18 and corresponding to that CHAR18 is used.
    Please see the attached screen shots.
    Regards,
    Krishna Chauhan

  • How to change Text to Number in Excel 2013

    Hi,
    I imported and parsed a large CSV file (75000 rows) with 4 columns as numbers. They arrive in Excel as text with a "." as decimal separator. In Excel options, I set the decimal separator to "." but data remains as text. I could edit and
    enter each cell to convert it as number but I have 4 x 75000 cells...
    Any idea ?
    Thanks for your help

    Hey Wlid1966,
    This simple action, I've included some links that explain you step by step:
    http://www.extendoffice.com/documents/excel/582-excel-change-text-to-number.html
    http://www.extendoffice.com/documents/excel/671-excel-change-number-to-text.html
    http://www.accountingweb.com/article/three-ways-convert-text-based-numbers-values/222008
    Please Mark This As Answer if it helps to solve the issue
    Tzuri Ben Ezra | My Certifications:
    CompTIA A+ ,Microsoft MCP, MCTS, MCSA, MCITP
    |
    FaceBook: Tzuri FaceBook | vCard:
    Tzuri vCard | 
    Microsoft ID:
    Microsoft Transcript 
     |

  • Interactive report sort text as number

    Hello,
    I was wondering if it is possible in an Apex interactive report to sort text as number?
    For example, a series of text rows:
    4
    10
    2
    would sort as:
    10
    2
    4
    if it were text. What I would like to see is:
    2
    4
    10
    How could this be done?
    Thanks.

    If your column contains numbers only, you could use TO_NUMBER (column_name) column_name to convert it to a numeric value and it will sort it properly.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Short text and number of outline not maintained error in BAPI_ENTRYSHEET_CREATE

    Hi Experts,
    I am using BAPI BAPI_ENTRYSHEET_CREATE' for creation of service entry sheets.
    I passed below data into the respective parameters
    Entry Header Sheet -
    SHORT_TEXT                
    THIS IS SAMPLE TEXT
    PO_NUMBER                 
    231002130
    PO_ITEM                   
    00010
    And just executed BAPI, I am able to get the ENTRYSHEET NUMBER.
    Next I tried passing below data again
    Entry Header Sheet -
    SHORT_TEXT                
    THIS IS SAMPLE TEXT
    PO_NUMBER                 
    231002130
    PO_ITEM                   
    00010
    ENTRYSHEETSERVICES:
    QUANTITY                             
    10.000
    BASE_UOM                  
    AU
    And then executed - I am getting an error saying 'Short text and number of outline not maintained'.
    My input file to  BAPI contains the structure as  PO, Item Number, Short Text for Service Entry sheet and Quantity.
    Please suggest if any ideas.
    Regards,
    Rafi

    Hi All,
    I resolved this. Please refer screen shots below for solution
    Below screen shots show about the data to be passed to BAPI_ENTRYSHEET_CREATE
    Regards,
    Rafi

  • How to you transform text in keynote

    How to you transform text like you can in powerpoint?

    Not sure exactly what you are trying to do, but this may have some useful information: http://help.apple.com/keynote/ipad/2.1/

  • My iphone 5 will not text one number

    Have seen previous threads on this issue but none have resolved this matter for me.
    There is one number that I cannot text, the other p contact a Samsung GT-S3350(Tesco) mine is on Vodafone.  I can receive texts and calls and can call the number, but texts fail to send and are all marked as Not Delivered.
    I have turned both phones on and off, turned on/off iMessage, 3G, data roaming and have reset network settings. I have also deleted the contact from my phone and the other phone.
    My wife has an iphone 5 and doesnt have any problems texting the number.
    Can anyone help?
    Thanks!

    I did solve the problem. I assumed because the message bubble was green that my friend had another type of phone. I was completely wrong! After I just made sure iMessage was on and restarted my phone it works just fine! So I guess iMessage was the problem ☺️

  • I cannot text one number in my phone that I have in the past...

    Since last week I cannot text one number in my phone, yet if I move my SIM into another phone it sends... any ideas? have tried wiping the SIM, re-starting the phone...

    Nevermind! I found out I can get a docking station that you can hook up from there to charge it! YEAH!

  • Cannot text one number

    I can not text one number and it is driving me crazy!!  I recieved a message that says "you can only send messages to fixed dialing numbers".  I do not know what that means.  I can send texts to Verizon, and T-Mobile phones.  I can send and recieve calls from the number but I can not text.  
    This is recent that this has happened.  I was able to send and recieve texts from this one numbers, but it seems as of OCtober, I can not.  
    Is anyone else having this issue??  It is truely driving me crazy!!

    Try checking Menu / Settings / Call Settings / FDN and make sure fix dialing option isnt enabled, if this is on this can restrict in and out going items.. 
    Another thing to check with Verizon and make sure no restrictions is setup on your accounts or you can check and make sure you havent added that number to the block list on the MyVerizon area of your account.

  • How to add text after number in the same cell? "200 units", "3Kg", "17 sqm"

    Dear Sirs,
    I have problem with adding text after a number in the same cell.
    For instance, in excel I am able to do this:
    200 units -----> this is on the same cell. Any number I type, "units" will follow automatically.
    I know that we can just type "200 units" but its in text format so it cannot be calculated supposedly I want to multiply it by others number.
    I know that we can do this by splitting into two cells, one on the left for the number "200" and another one on the right for the text "units".
    It would be helpfull if we could do this function such as "20 years", "3Kg" etc.
    Sorry to trouble you all.
    Thank you
    Q

    This is a case of uneven implementation in Numbers. This sort of functionality is available to format numbers used to label axis ticks on various charts, but not to format numbers in a cell. This feature should be requested.
    As an aside, perhaps a spreadsheet that actually managed numeric units as part of the calculation would be powerful and useful in avoiding formula bugs, something like is available in Google calculations. If you are unfamiliar with this, try one of the following examples typed into any Google search entry field:
    150 miles per gallon in liters per 100 kilometers
    100 * 20 yards / 40 minutes in mph
    Read more at http://www.google.com/intl/en/help/features.html#calculator

  • Text to number and decimalSeparator

    Hi, I need to convert a text (in a textImput) to Number.
    Some times the user type: 1000.10 or 1000,10 do represent the
    same number (one thousand and 10 cents)
    the problema is that 1000,10 gives me NaN using the simple
    way: Number(mytxt.text)
    How can I solve this problem?

    If there is no thousands separator (Like: english 1,000.00
    represents one thousand; spanish/german: 1.000,00 represents the
    same thousand):
    I'd replace the comma with a decimal point (using indexOf to
    find it), and later use Number() to convert:
    s = textInput.text;
    if (s.indexOf(",") != -1)
    s = s.substr(0, s.indexOf(",") + "." +
    s.substr(s.indexOf(",")+1, s.length - 1 - s.indexOf(",");
    number = Number(s);
    I hope is readable :-), and helps

  • Access Web App - Need some advice with query (text to number problem)

    In an Access Web App I want to create a query.
    I have two tables which are related but in a bit complicated way. For some reason I have a text field in which I save a number. This number relates to the ID of another table. When I combine these two tables in a query, it's not working because the textfield
    cannot query the (ID)number field.
    Is there a way, in this query so that I covert the text field to a number so the query will work?
    I tried to do it with the "Parse" function but no luck, so far.
    Thanks, Mike

    Hi Mike,
    Based on the description, you want to create a query by joining a text filed with number filed?
    Did I understood correctly? If so, as far as I test, it works in Access 2013 web app. Here is the screen shot for your reference:
    If I misunderstood, please feel free to let me know.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Replace text with number

    Hi
    i have 2 columns from flat file
    0amount       number
    10000          
    "Intangibles"         2000
    20000              
    'sales'         4000
    my output is required like
    incase if i am getting text ( this text is not constant its coming like any thing shownw above example)  i need replace number key figure values in 0amount fileds.
    how can i reach with this in field routine
    data v_text type char
    if source_fields_0amount not equall number
    result 0 number ( kf)
    like what is code i need to use

    Hi,
    One thing's to be clarified :
    If you need sometimes number & sometimes text in a particular target field, then it has to be a char field and you cant do any mathematical operation on that later.
    --Akashdeep

  • Text item number checking

    Hi,
    is there a way werein the user can only input numbers and a decimal point into a text item.
    thanks,
    psdilag

    Hello,
    I am finding no problem in using this function in PL/SQL as well as forms. Here is what i have done in PL/SQL:
    SQL> create or replace function isnumeric ( p_string in varchar2)
    2 return boolean
    3 as
    4 l_number number;
    5 begin
    6 l_number := p_string;
    7 return TRUE;
    8 exception
    9 when others then
    10 return FALSE;
    11 end;
    12 /
    Function created.
    SQL> set serveroutput on
    SQL> declare
    2 a number;
    3 begin
    4 if isnumeric(123) then
    5 dbms_output.put_line('number');
    6 else
    7 dbms_output.put_line('char');
    8 end if;
    9 end;
    10 /
    number
    PL/SQL procedure successfully completed.
    And in forms i used this code at WHEN-BUTTON-PRESSED trigger for testing purpose and here also it worked very well for me..........

  • VS2012 - Build - Transform text templates

    We have a relatively large solution file (25 projects). If I build any one of these projects, the final build step is "Transforming templates for all project items". Does anyone know where the setting is to toggle this functionality in visual studio
    2012.
    I thought it was my 'power commands' plugin which was doing this, but I've turned it off but doing so hasn't stopped the functionality.
    It causes all the builds to hang for 5 - 6 seconds at the end, and for something that isn't really needed for each and every build its getting a bit annoying.
    I removed a bunch of add-ins from my VS but no luck.
    These were:
    VS Power Commands
    VS productivity tools
    Tangible T4 Editor (free)
    I've since started VS with all add-ons disabled, but it still does it.
    Strange thing is, in one branch it doesn't do it and in others it does, even after a full merge. I tried deleting the .suo file but it made no difference.
    It even runs if I start a build, and then cancel it.
    Any insights are appreciated.

    Hi marlon_tucker,
    I doubt that the output informaiton would be related to the T4 text templates, could you get the .tt files in your project?
    Reference:
    https://msdn.microsoft.com/en-us/library/bb126478.aspx
    https://msdn.microsoft.com/en-us/library/ee844259.aspx
    If you want to disable it when you build it, maybe you could think about changing the property of this .tt file.
    http://stackoverflow.com/questions/13594860/how-to-disable-t4-template-auto-run-in-visual-studio-2012
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • IPod 5th Gen Button Jammed and Won't Turn On

    Hello! I have a small predicament and am unable to find the solution. Yesterday I was watching a  movie and suddenly my iPod wouldn't turn on! It was more than half way full on battery and working fine before! Now, the screen is black, my PC won't re

  • Error Msg says Firefox 4.0 "incompatible" with Mac OS 10.4.11?

    Just downloaded 4.o and it will not launch. I deleted 3.6.16. so now: no Firefox. Advice would be appreciated! Thanks!

  • Auto Clearing of Part of Cutomer invoice against Down Payment Received

    Hi, I am working for a construction company project. The scenario is - At the time of contract customer pays the down payment e.g. USD 100,000. During the execution of the project customer will be billed every quarter. The invoice will be generated f

  • Help regarding tabuler

    i have creted two blocks in my form 1 is form and other is tabuler i want to get date from another table when cat_id is given in :issue.cat_id and i want to show that all dara in :issue_detail.serial_no and :issue_detail.cat_id plz help me regarding

  • Does OC4J DP4 works well at AIX 5.2 (Java Version=1.4.2) ?

    when I first start oc4j dp4, It prompted me to insert password for oc4jadmin. and when I restart oc4j dp4, oc4j made java core dump and crashed. Is there any requirement for oc4j to work well on AIX 5.2 ?