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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
jay_patel
Helper IV
Helper IV

Get earlier Rate in next month if it is blank

Hello All,

I have a dataset as mentioned below, here OU is coming from Companymst, Month-year from Calendar and Rate from Exchange Rate Table, what i want is if any month-year have blank rate then it should carry earlier Rate for that OU.

OUMonth-year Rate
ABCApr-243
ABCMay-244
ABCJun-24 
DEEApr-245
DEEMay-24 
DEEJun-24 


Result Column/measure:

Filled Rate
3
4
4
5
5
5



Thanks in advance.


1 ACCEPTED SOLUTION

Measure to Fill Blank Rates:

Filled Rate = 
VAR CurrentRate = MAX('Exchange Rate Table'[Rate])
RETURN
IF (
NOT ISBLANK(CurrentRate),
CurrentRate,
CALCULATE(
MAX('Exchange Rate Table'[Rate]),
FILTER(
ALL('Calendar'),
'Calendar'[Month-Year] < MAX('Calendar'[Month-Year])
&& 'Companymst'[OU] = MAX('Companymst'[OU])
)
)
)

This approach will ensure that any missing rate for a Month-Year will be filled with the last available rate from earlier months within the same OU

View solution in original post

6 REPLIES 6
ryan_mayu
Super User
Super User

@jay_patel 

 

you can try this

 

Measure =
VAR _date=maxx(FILTER(all('Table'),'Table'[OU]=max('Table'[OU])&&'Table'[Month-year]<max('Table'[Month-year])&&not(ISBLANK('Table'[ Rate]))),'Table'[Month-year])
return if(ISBLANK(max('Table'[ Rate])),maxx(FILTER(all('Table'),'Table'[OU]=max('Table'[OU])&&'Table'[Month-year]=_date),'Table'[ Rate]),max('Table'[ Rate]))
 
11.PNG




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




MNedix
Super User
Super User

Heya,

 

In PowerQuery, simply right-click on the column --> Fill --> Down

 

MNedix_0-1728367705649.png

 



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

Measure to Fill Blank Rates:

Filled Rate = 
VAR CurrentRate = MAX('Exchange Rate Table'[Rate])
RETURN
IF (
NOT ISBLANK(CurrentRate),
CurrentRate,
CALCULATE(
MAX('Exchange Rate Table'[Rate]),
FILTER(
ALL('Calendar'),
'Calendar'[Month-Year] < MAX('Calendar'[Month-Year])
&& 'Companymst'[OU] = MAX('Companymst'[OU])
)
)
)

This approach will ensure that any missing rate for a Month-Year will be filled with the last available rate from earlier months within the same OU

Hi @Kedar_Pande 

It is not working fine actually, instead of the earlier date it is taking max Exchange Rate from entire table for specific month.

for example filled rate should be, but someow it is taking max exchange rate from entire table for month - Oct. if i had max rate in Apr-2024 then it will take exchange rate from Apr. instead of earlier date for every month.

Appreciate your efforts.please suggest another solution


OUDate Ratefilled rate
ABC01-Oct-2433
ABC02-Oct-2444
ABC03-Oct-24 4
ABC04-Oct-2455
ABC05-Oct-24 5
ABC06-Oct-24 5
bhanu_gautam
Super User
Super User

@jay_patel , You can create a calculated column for this using

 

Filled Rate =
VAR CurrentOU = 'Table'[OU]
VAR CurrentMonthYear = 'Table'[Month-year]
RETURN
CALCULATE(
LASTNONBLANK('Table'[Rate], TRUE),
FILTER(
'Table',
'Table'[OU] = CurrentOU &&
'Table'[Month-year] <= CurrentMonthYear
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam 

Thanks for you efforts!

But here i can't create a calculated column, because I'm not sure i do have every month-year in Exchange Rate Table, i want a measure where every month-year is coming from calendar.

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors