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
Shearer
Frequent Visitor

lookup value based on measure

Hi there :),

 

I have the following data:

 

ProductMonthVolume ForecastVolume ActualsSpend FCActual Spend
abc01.2022 1 888
abc02.2022 1 888
abc03.2022 1 888
abc04.2022 1 888
abc05.2022 1 888
abc06.2022 1 888
abc07.2022 1 888
abc08.2022 1 888
abc09.2022 1 888
abc10.20221 900 
abc11.20221 900 
abc12.20221 900 
ccc01.2022 1 222
ccc02.2022 1 222
ccc03.2022 1 222
ccc04.2022 1 222
ccc05.2022 1 222
ccc06.2022 1 222
ccc07.2022 1 222
ccc08.2022 1 222
ccc09.20221 250 
ccc10.20221 250 
ccc11.20221 250 
ccc12.20221 250 

 

where I need to get the Actual Spend for the last month for which I have Volume Actuals, per product. I already created a measure to calulate the last month per product "Measure 1"= CALCULATE(MAX(table[Month]),FILTER(table, table[Volumes Actuals]=1)). I was thinking that if I use LOOKUPVALUE(table[Volumes Actuals], table[Month], Measure 1 it will work, but it doesn't :(.

 

Could you please help?

 

Thanks,

Shearer

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Shearer 

We cannot refer to a measure in LOOKUPVALUE function. You can use function ‘’calculate“ and ”filter“ to replace function ”lookupvalue“

Please try measure formula like:

_last month = CALCULATE(MAX('table'[Month]),FILTER(ALL('table'),'table'[Volume Actuals]=1),'table'[Product]=MAX('table'[Product] ))
_New Actual Spend = CALCULATE(MAX('table'[Actual Spend]),FILTER(ALL('table'),'table'[Product]=MAX('table'[Product])&&'table'[Month]=[_last month]))

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Shearer 

We cannot refer to a measure in LOOKUPVALUE function. You can use function ‘’calculate“ and ”filter“ to replace function ”lookupvalue“

Please try measure formula like:

_last month = CALCULATE(MAX('table'[Month]),FILTER(ALL('table'),'table'[Volume Actuals]=1),'table'[Product]=MAX('table'[Product] ))
_New Actual Spend = CALCULATE(MAX('table'[Actual Spend]),FILTER(ALL('table'),'table'[Product]=MAX('table'[Product])&&'table'[Month]=[_last month]))

Best Regards,
Community Support Team _ Eason

Thanks @v-easonf-msft, this solves my issue (for now 😁). Take care

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.