Forum Discussion

Lauraeire_81's avatar
Lauraeire_81
Helper I
1 year ago
Solved

Add text string to value

Hi I am looking to add a text value to a Calculate value.  CALCULATE(DISTINCTCOUNT('Report Results'[Critical areas])   I would like to add a text strings at both ends like this; "The total is" ...
  • bhanu_gautam's avatar
    1 year ago

    Lauraeire_81 To achieve this in DAX, you can use the & operator to concatenate text strings with your calculated value

     

    "The total is " & CALCULATE(DISTINCTCOUNT('Report Results'[Critical areas])) & " critical areas"

  • johnt75's avatar
    1 year ago

    Another option is use a dynamic format string. The advantage of this approach is that the measure still returns a numeric value, which means you can use it in chart visualisations and also use it in other measures, e.g. to calculate averages.

    To use a dynamic format string, choose Dynamic from the Format dropdown and use a DAX formula like

    "The total is " & FORMAT(SELECTEDMEASURE(), "#,0") & " critical areas."