Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Measure Error - End Result out by one Row Position

Hi Experts

 

See image below of end result, the current measure is off by one row, ie. the end result needs to shift up one. all the values are correct be in the wrong position (move up one)

Image

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Measure

The measure was done by another User on the forum. But i cannot work out what to change in order to shift up one position the end result.

 

Measure =
var _currPeriod = max('Sample'[MonthKey])
var _last6 = topn(6, Filter(ALL('Sample'[MonthKey]), 'Sample'[MonthKey] < _currPeriod), 'Sample'[MonthKey])
var _last6Cnt = COUNTROWS(_last6)
var _numerator = CALCULATE(SUMX( 'Sample', 'Sample'[Amount] * 'Sample'[Rate]), _last6, all('Sample'))
var _denominator = CALCULATE(sum('Sample'[Amount]), _last6, all('Sample'))
return if(_last6Cnt >= 6, DIVIDE( _numerator , _denominator))

 

  • Anonymous , is month key a date or number . I think you move back month like

     

    var _currPeriod = max('Sample'[MonthKey]) -1

    or

    var _currPeriod = eomonth(max('Sample'[MonthKey]),-1)

3 Replies

  • Anonymous , is month key a date or number . I think you move back month like

     

    var _currPeriod = max('Sample'[MonthKey]) -1

    or

    var _currPeriod = eomonth(max('Sample'[MonthKey]),-1)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Amit not working....

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    What is the specific value of Month Key ? What is the exact result you need in the end ?

     

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.