Forum Discussion

naveenpadala's avatar
naveenpadala
Regular Visitor
2 years ago
Solved

Concatenating decimal value column with '%' when a string column contains '%' in it.

data view visual view   Above is the table i have. Amount column is storing values as decimals which includes percentage values also (see SubCategory column). but i want to show '%' symbol...
  • Ritaf1983's avatar
    2 years ago

    Hi naveenpadala 
    if I understood you correctly you can surround your measure with "If"
    Like : 

    formated_% = if(CONTAINSSTRING(SELECTEDVALUE('Table'[category]),"%"),FORMAT([your measure_],"0.0%"),FORMAT([your measure_],"0"))

     


    Pbix attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

     

     

  • Ritaf1983's avatar
    Ritaf1983
    2 years ago

    Hi naveenpadala 
    Please update the formula to :

    formated_%2 = if(CONTAINSSTRING(SELECTEDVALUE('data'[SubCategory]),"%"),FORMAT(SUM([Sum of Amount]),"0.00")&"%",FORMAT(sum(data[Sum of Amount]),"0.00"))

    The updated PBIX attached 

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.