Forum Discussion

Fusilier2's avatar
Fusilier2
Icon for Helper V rankHelper V
1 year ago
Solved

Adding leading and trailing characters to measure

Hope this is easy to solve:

I have this expression that works fine:

VAR KPI Incr good % Total =
VAR Excl_Casuals_MOM =
IF(HR_data[Headcount Excl Casuals month on month]<0,1,0)
VAR Apprentices_MOM=
IF(HR_data[Apprentices month on month]<0,1,0)
VAR mytest = 12
VAR Total_MOM = Excl_Casuals_MOM+Apprentices_MOM
RETURN
DIVIDE(Total_MOM,mytest)
 
It displays the returned value in a card visual.
Is it possible to amend the measure so that it displays characters before and after the value?
So, for example instead of 17% it shows (17%).
I've tried adding
"("&
DIVIDE(Total_MOM,mytest)
&")"
but that doesn't work.
 
  • Hi Fusilier2 

    Can you please try the below DAX?

    I have just corrected the RETURN Part. (It should be formatted in text format.)

     

     

    VAR KPI Incr good% % Total =
    VAR Excl_Casuals_MOM =
    IF(HR_data[Headcount Excl Casuals month on month] < 0, 1, 0)
    VAR Apprentices_MOM =
    IF(HR_data[Apprentices month on month] < 0, 1, 0)
    VAR mytest = 12
    VAR Total_MOM = Excl_Casuals_MOM + Apprentices_MOM
    VAR Result = DIVIDE(Total_MOM, mytest)
    RETURN
    "(" & FORMAT(Result, "0%") & ")"


    If this answers your questions, kindly accept it as a solution and give kudos.

2 Replies

  • Hi Fusilier2 

    Can you please try the below DAX?

    I have just corrected the RETURN Part. (It should be formatted in text format.)

     

     

    VAR KPI Incr good% % Total =
    VAR Excl_Casuals_MOM =
    IF(HR_data[Headcount Excl Casuals month on month] < 0, 1, 0)
    VAR Apprentices_MOM =
    IF(HR_data[Apprentices month on month] < 0, 1, 0)
    VAR mytest = 12
    VAR Total_MOM = Excl_Casuals_MOM + Apprentices_MOM
    VAR Result = DIVIDE(Total_MOM, mytest)
    RETURN
    "(" & FORMAT(Result, "0%") & ")"


    If this answers your questions, kindly accept it as a solution and give kudos.

    • Fusilier2's avatar
      Fusilier2
      Icon for Helper V rankHelper V

      That works. Thank you so much for your help!