Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DAX help

Hi,

 

I am trying to calculate the below formula in Power BI as a calculated column:

 

K = ( (C - L) / (H - L) ) * 100

Where:

C = The current closing price (i.e the current row) 

L = Lowest closing Price for last 14 days

H = Highest closing price for the last 14 days

 

Sample Data:

DateClosing Price
11/13/20191589.18
11/14/20191588.79
11/15/20191596.45
11/18/20191592.34
11/19/20191598.29
11/20/20191591.61
11/21/20191583.96
11/22/20191588.94
11/25/20191621.9
11/26/20191624.23
11/27/20191634.1
11/29/20191624.5
12/2/20191607.58
12/3/20191602.63
12/4/20191613.9
12/5/20191614.83
12/6/20191633.84
12/9/20191629.62
12/10/20191631.71

 

I greatly appreceate any help!

Thanks

  • Anonymous solution is attached, look at HLC and Calendar table, there are more tables in the file, just ignore those

     

     

3 Replies

Replies have been turned off for this discussion
    • parry2k's avatar
      parry2k
      Super User

      Anonymous solution is attached, look at HLC and Calendar table, there are more tables in the file, just ignore those

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        parry2k  Thanks for your response. 

         

        The L and H measures should cosider the previsous 14 days at every row level.

         

        For example, for 12/10/2019 L and H values should take (12/10/2019 to 11/19/2019) date range into calculation.

         

        Similarly, for 12/09/2019 row L and H values should take (12/09/2019 to 11/18/2019) date range.

         

        Any thoughts on this?

         

        Thanks