title: Dynamic Index Price Value PowerBI
body: <p>I have an issue that I believe its very simple to tackle but I cannot find the way.</p>
  <p>First I needed to scale/index an stock price to 1.0 in order to make it comparable with other stocks with dynamic timeframe.</p>
  <p>I've found the solution here: <a href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/Scaling-time-series-data-based-on-starting-date-value/m-p/987708#M12214" rel="nofollow noreferrer">https://community.powerbi.com/t5/DAX-Commands-and-Tips/Scaling-time-series-data-based-on-starting-date-value/m-p/987708#M12214</a></p>
  <p>My issue now is that I need that measure to return a percentage of gain or loss, for example, if the measure above returns 1.2, I need it to return 0.2 or 20%.</p>
  <pre><code>Scaled Value 2 = 
  VAR oneDateVisible =
  HASONEVALUE(
      Dates[Date]
  )
  
  VAR firstVisibleDate =
  FIRSTDATE(
      ALLSELECTED(
          Dates[Date]
      )
  )
  
  VAR scaler = 
  CALCULATE(
      SUM(
          NAVs[Valor mil Cuotapartes]),
          firstVisibleDate
  )
  
  VAR result =
  DIVIDE(
      SUM(
          NAVs[Valor mil Cuotapartes]),
          scaler
  )
  
  RETURN
  IF(oneDateVisible,result)
  </code></pre>