Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

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

Capture.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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))

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@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)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
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.

amitchandak
Super User
Super User

@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)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi Amit not working....

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.