Forum Discussion

srinudatanalyst's avatar
srinudatanalyst
Frequent Visitor
1 year ago
Solved

Text should be text and numeric values ​​should be converted to percentage

Hi everyone,

One Column (Data type text) contains text and numeric values.

Text should be text and numeric values ​​should be converted to percentage in Power BI.

how i will get this.

 

This is sample data

 

Thanks and regards

Gopi

7 Replies

  • data_msfabric's avatar
    data_msfabric
    Frequent Visitor

    Hi, You can try at Power Query lik this:

     

    Custom column in Power query:

    = Table.AddColumn(#"Changed Type", "Custom column in Power Query", each if Text.Select([Q1], {"0".."9", ".", "-"}) = [Q1] then Number.ToText(Number.From([Q1]) * 100) & "%" else [Q1])

     

    Or with a calculated column like this:

     

    Q1_Percent =
    VAR Val = SUBSTITUTE([Q1], "%", "")
    VAR NumVal =
        IF (
            ISERROR ( VALUE ( Val ) ),
            BLANK(),
            VALUE ( Val )
        )
    RETURN
    IF (
        NOT ISBLANK ( NumVal ),
        FORMAT ( NumVal , "0.0%" ),
        [Q1]
    )

     

  • bchager's avatar
    bchager
    Icon for Resolver III rankResolver III

    srinudatanalyst  Here's an approach using custom columns in the query editor (M), and DAX calculated columns. One multiplies the original number by 100 and one doesn't. A sample .pbix is attached.

     

     

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi srinudatanalyst 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi srinudatanalyst 
    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
    Thank you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi srinudatanalyst 
    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
    Thank you.