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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sudharsanan
Helper III
Helper III

Need to fill blank rows with previous month value

Hi All,

 

Could someone help me with the below scenerio please? The blank row should have the previous months value as shown in the expected column.

 

MonthPriceExpected Result
Jan 3939
Feb 39
Mar 39
Apr40.3140.31
May 40.31
June44.9744.97
July 44.97
Aug47.0247.02
Sep49.1349.13
Oct 49.13
Nov46.246.2
Dec 46.2
1 ACCEPTED SOLUTION

@Sudharsanan - Let me know if this DAX-based solution meets your requirement, then I'll post the pbix file.

Manoj_Nair_0-1670262325231.png

LookupTable = FILTER('Price Table', 'Price Table'[Price] >0)
Derived Price = 
VAR currmonth = MAXX(FILTER(LookupTable, LookupTable[MonthNumber] <= SELECTEDVALUE('Price Table'[MonthNumber])),LookupTable[MonthNumber])
VAR result = CALCULATE(MAX('LookupTable'[Price]), LookupTable[MonthNumber] = currmonth)
return result

 

View solution in original post

6 REPLIES 6
Manoj_Nair
Solution Supplier
Solution Supplier

@Sudharsanan - try this at the power query back end data - Let me know if this fix, then accept it as a solution. Microsoft document on fill down Many Thanks

Manoj_Nair_0-1670259315450.png

 

Thanks @Manoj_Nair i knew this earlier but i wanted to handle this using DAX

@Sudharsanan - Let me know if this DAX-based solution meets your requirement, then I'll post the pbix file.

Manoj_Nair_0-1670262325231.png

LookupTable = FILTER('Price Table', 'Price Table'[Price] >0)
Derived Price = 
VAR currmonth = MAXX(FILTER(LookupTable, LookupTable[MonthNumber] <= SELECTEDVALUE('Price Table'[MonthNumber])),LookupTable[MonthNumber])
VAR result = CALCULATE(MAX('LookupTable'[Price]), LookupTable[MonthNumber] = currmonth)
return result

 

Thanks @Manoj_Nair but am not sure what you are referring  as a  Lookup Table here. so pbix file will help me ?

@Sudharsanan - PBIX file attached

@Manoj_Nair  thanks for this

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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