Forum Discussion

Chainfire74's avatar
Chainfire74
Helper I
4 years ago
Solved

Add text within calculation measure

Hi,

 

This calculation gives me an average number, but is it possiblefor me to add the word 'Years' after the calculation so it is in one data card?

 

Average Tenure of Leavers =
CALCULATE(AVERAGE(Leavers3[Years Service]))

 

Thanks

  • AntonioM's avatar
    AntonioM
    4 years ago

    You would need to FORMAT the number before it's joined.

     

    CONCATENATE ( 
        FORMAT ( 
            CALCULATE ( 
                 AVERAGE ( Leavers3[Years Service] ) 
            ),
            "0.00"
        ),
       " years" 
    ) 

     There are different options instead of "0.00", you can find them all here 

5 Replies

  • AntonioM's avatar
    AntonioM
    Solution Sage

    You can use CONCATENATE

    CONCATENATE ( CALCULATE ( AVERAGE ( Leavers3[Years Service] ) ), " years" ) 
    • Chainfire74's avatar
      Chainfire74
      Helper I

      Thanks. When I do this, it does work - but I'm unable to change the decimal places. Any ideas? 

       

       

       

       

      • AntonioM's avatar
        AntonioM
        Solution Sage

        You would need to FORMAT the number before it's joined.

         

        CONCATENATE ( 
            FORMAT ( 
                CALCULATE ( 
                     AVERAGE ( Leavers3[Years Service] ) 
                ),
                "0.00"
            ),
           " years" 
        ) 

         There are different options instead of "0.00", you can find them all here 

  • MahyarTF's avatar
    MahyarTF
    Memorable Member

    Hi,

    Use this Dax Measure :

    format(CALCULATE(AVERAGE(Leavers3[Years Service])), "#Year#$#,0.00")