0

Assume there's a table T1 with columns [state],[product],[price],[store],[date], and a time table T2. There's a relationship between T2's [pk_date] column and T1's [date] columnit.

and I create a measure [5days moving average price]:

calculate ( average('T1'[price]) , DATESINPERIOD ( 'T2'[pk_Date], LASTDATE ( 'T2'[pk_Date] )-1, -5, DAY ) )

but for certain state and product, is there anyway I can get a rank of stores based on the [5days moving average price]? I tried something like :=RANKX(ALLSELECTED('T1'[store]),[5Days Moving AVERAGE PRICE],,1) but it didn't work.

  • The closest one I can get is :=RANKX(ALLSELECTED('T1'),[5Days Moving AVERAGE PRICE],,1) , it kind of works, but when the [5Days Moving AVERAGE PRICE] has very close value, and 10.1 and 10.11, this rankx will give them both the same rank, like rank=3 for 10.1, rank=3 for 1.11 too. I've stuck here cluelessly – user3330433 Mar 27 '16 at 19:36
  • How about `:=RANKX(ALLSELECTED('T1'),([5Days Moving AVERAGE PRICE]*100),,1)`? – user5226582 Apr 15 '16 at 09:45

0 Answers0