Forum Discussion

hokitkan's avatar
hokitkan
Frequent Visitor
9 years ago
Solved

Do calculation on cell level

Hello everyone! I'm new to power BI and now I'm facing some problems about calculating on cell level. I've got some data about the growth rate of different kinds of virus.  Here is the Sample file ...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Well, the good news is that it is certainly possible, if a bit tricky :)

     

    You are looking for... whatever value is stored at... the max time that is LESS THAN the current time.

     

    May be easier to break this into 2 columns, but ... we are feeling lucky.  I would try:


    Prior A Value =
         VAR MyTime = Trials[Time]
         VAR MyVirus = Trials[Virus]
         VAR PriorTime = CALCULATE(MAX(Trials[Time]), FILTER(ALL(Trials), Trials[Time] < MyTime && Trials[Virus] = MyVirus))
         RETURN CALCUALTE(VALUES(Trials[Average Growth Rate]), FILTER(ALL(Trials), Trials[Time] = PriorTime && Trials[Virus] = MyVirus))