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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Converting Measure to Calculated Column

Hi Everyone! Please see this PBIX file: https://drive.google.com/drive/folders/1tOkjeovhg5U8QKIsf9PyJ9-sRNewVnXU

I need help with converting the measure 'BP' to a Calculated Column. I tried pasting the same code as the measure as a Calculated Column but it returned Blanks for all the rows. Requesting all the help please ! 

For details on the logic behind measure 'BP' please refer this post : https://community.powerbi.com/t5/Desktop/Calculate-the-Latest-Price-from-within-previous-3-years-for...

Basically I need the same results as the measure but I need a Calculated Column instead. 

Let me know if there are any questions. 

Thanks in advance & kind regards !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please have a try.
Create a column.

column = var last= CALCULATE(MAX(Data[Year]),FILTER(Data,Data[Year]<EARLIER(Data[Year])&&Data[Country]=EARLIER(Data[Country])))
var three_=CALCULATE(MAX(Data[Price]),FILTER(Data,Data[Year]=last))
var not_in = CALCULATE(MAX(Data[Year]),FILTER(Data,Data[Year]<EARLIER(Data[Year])))
var rrr= CALCULATE(MAX(Data[Price]),FILTER(Data,Data[Year]=not_in))
var result = IF(last>=Data[Year]-3,three_,rrr)
return result

111.PNG

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

 

 

Best Regards

Community Support Team _ Polly

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

Please have a try.
Create a column.

column = var last= CALCULATE(MAX(Data[Year]),FILTER(Data,Data[Year]<EARLIER(Data[Year])&&Data[Country]=EARLIER(Data[Country])))
var three_=CALCULATE(MAX(Data[Price]),FILTER(Data,Data[Year]=last))
var not_in = CALCULATE(MAX(Data[Year]),FILTER(Data,Data[Year]<EARLIER(Data[Year])))
var rrr= CALCULATE(MAX(Data[Price]),FILTER(Data,Data[Year]=not_in))
var result = IF(last>=Data[Year]-3,three_,rrr)
return result

111.PNG

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

 

 

Best Regards

Community Support Team _ Polly

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors