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

Lookup value based on a measure

Hello,

I need help to solve this:

I have a measure, let say Sales/ Total Sales and I have a disconnected table with percetages and Amounts and I need to get the amount correponding to the percentage calculated, 

Ex. Ind Sales/ Total Sales = 95.3%

So In this case I should get 2000

 

PercentageAmount
94%1000
95%2000
96%3000

 I tried to use this formula but it's not working:

 

 Var DS=[measure]
Return MAXX(
TOPN (
1,
Table,
ABS (DS) ,ASC
), Table[Amount])
 
1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @leshugaa19 ,

I use the following two tables for testing.
Table1.

vcgaomsft_0-1651559008441.png

Table2.

vcgaomsft_1-1651559040339.png

If you want a calculated column.

Column = 
VAR _percentage = ROUNDDOWN('Table1'[Percentage],2)
RETURN
LOOKUPVALUE('Table2'[Amount],'Table2'[Percentage],_percentage)

vcgaomsft_2-1651559214351.png

Or a measure.

Measure 2 = 
VAR _percentage = ROUNDDOWN([Measure],2)
RETURN
LOOKUPVALUE('Table2'[Amount],'Table2'[Percentage],_percentage)

vcgaomsft_3-1651559248233.png

 

Attached PBIX file for reference.

 

Best Regards,
Community Support Team Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
leshugaa19
Frequent Visitor

Thank you, It worked perfectly

v-cgao-msft
Community Support
Community Support

Hi @leshugaa19 ,

I use the following two tables for testing.
Table1.

vcgaomsft_0-1651559008441.png

Table2.

vcgaomsft_1-1651559040339.png

If you want a calculated column.

Column = 
VAR _percentage = ROUNDDOWN('Table1'[Percentage],2)
RETURN
LOOKUPVALUE('Table2'[Amount],'Table2'[Percentage],_percentage)

vcgaomsft_2-1651559214351.png

Or a measure.

Measure 2 = 
VAR _percentage = ROUNDDOWN([Measure],2)
RETURN
LOOKUPVALUE('Table2'[Amount],'Table2'[Percentage],_percentage)

vcgaomsft_3-1651559248233.png

 

Attached PBIX file for reference.

 

Best Regards,
Community Support Team Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

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.