Forum Discussion

elzahy's avatar
elzahy
New Member
3 years ago
Solved

How to create fraction based on 2 calculated columns

Hello,

 

I would like to display fraction in name card based on 2 calculated columns.
fraction=

var given= 'table'[R]
var precision='table'[T]
return (given*precision/GCD(given*precision,precision))&"/"&(precision/GCD(given*precision,precision))
 
However, my result is 4.0032251562185/4965
My desire result should be 4/4965 
 
Anyone can help?
 
Thank you
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  elzahy ,

    You can try the following dax:

    Column =
    var given= 'table'[R]
    var precision='table'[T]
    var value1=given*precision/GCD(given*precision,precision)
    var value2=precision/GCD(given*precision,precision)
    return
    FORMAT(value1,"$#,##0") &"/"& value2

     

    Best Regards,

    Liu Yang

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  elzahy ,

    You can try the following dax:

    Column =
    var given= 'table'[R]
    var precision='table'[T]
    var value1=given*precision/GCD(given*precision,precision)
    var value2=precision/GCD(given*precision,precision)
    return
    FORMAT(value1,"$#,##0") &"/"& value2

     

    Best Regards,

    Liu Yang

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