Forum Discussion

dfs29's avatar
dfs29
Helper I
3 years ago
Solved

divide function

Hello ,    I am trying to divide "_Total (hm)" with "_Total_total" but it dosn't work because total type is text not number  So I tried to convert "_Total (hm)" to second and try again but failed ...
  • v-jianboli-msft's avatar
    3 years ago

    Hi dfs29 ,

     

    If they are text type, please try:

    hm = 
    var _hh = VALUE(LEFT(MAX('Table'[_Total (hm)]),(FIND(":",MAX('Table'[_Total (hm)]))-1)))
    var _mm = VALUE(LEFT(RIGHT(MAX('Table'[_Total (hm)]),5),2))
    var _ss = VALUE(RIGHT(MAX('Table'[_Total (hm)]),2))
    return _hh*60*60+_mm*60+_ss
    
    total = 
    var _hh = VALUE(LEFT(MAX('Table'[_Total_total]),(FIND(":",MAX('Table'[_Total_total]))-1)))
    var _mm = VALUE(LEFT(RIGHT(MAX('Table'[_Total_total]),5),2))
    var _ss = VALUE(RIGHT(MAX('Table'[_Total_total]),2))
    return _hh*60*60+_mm*60+_ss
    
    Percentage = DIVIDE([hm],[total]) 

    Final output:

     

    Best Regards,

    Jianbo Li

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