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

Lookup a value in the dataset by calculating the position of the looked up value in the dataset

I have a problem. I would like to lookup a value in the dataset. The values are sorted from lowest to highest value.

The position of the value that has to be looked up is calculated, by the folowing measure:

Position value that has to be selected = ROUND([Variable A] - (1,5*[Variable B]);0)

where:

Variable A = DISTINCTCOUNT(data[Date])

and

Variable B = [Variable A]/365

 

In the report there are 2 filters:

- location filter to select the location

- date-slicer

 

Result of the report is the value at the position of the index that equals the result of measure "Position value that has to be selected". (e.g. Result of measure "Position value that has to be selected" = 6. Another measure has to lookup the value at position 6 in the dataset)

 

I think I have to make a dynamic index column and a lookup measure, but I can't get it work.

 

The example PBI-report and dataset can be downloaded via the following link:

https://www.dropbox.com/sh/3qve0rh45bfxk9h/AAAJjZ0T7awhcfjhiuCYBT9ea?dl=0

It is a small part of the complete dataset I use, but I think it will be enough for answering my quenstion

 

In tab 1 of the PBI-report there is a table of the dataset and the Query that manipulated the data in PowerQuery. In tab 2 there is the example of te report

Thanks

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Anonymous,

Please check DAX in the PBIX file below.

https://1drv.ms/u/s!AhsotbnGu1NolA-pldfc-xnQJyjE

Regards,
Lydia

View solution in original post

Anonymous
Not applicable

@Anonymous,

You would need to firstly rank your table visual based on Value field, then compare the rank value to the position value to get expected row.

Regards,
Lydia

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Anonymous,

If I understand you correctly, you just need to create a measure as follows.

maxaverage = MAX(data[Average_Value])


More details in this PBIX file: https://1drv.ms/u/s!AhsotbnGu1NolAxYwAt3tipzk9zF

Regards,
Lydia

Anonymous
Not applicable

Hello @Anonymous Lydia,

Thanks for your answer. 

It is not always the maximum value. I've added a larger dataset to the PBIX-file: https://www.dropbox.com/s/xk2n9gxio8le0qv/Example.zip?dl=0

 

As you can see, the position of the value that I need is most of the time not the maximum. for example: at location ADCP216B_V1 there are 672 values. The value that I need is at position 669 in the data table.

 

Regards,

Paul

Anonymous
Not applicable

@Anonymous,

Please check DAX in the PBIX file below.

https://1drv.ms/u/s!AhsotbnGu1NolA-pldfc-xnQJyjE

Regards,
Lydia

Anonymous
Not applicable

@Anonymous

 

Thanks. I think it is the solution of my question. Can you explain for me what you did (and why). That helps me with checking the results.

 

Anonymous
Not applicable

@Anonymous,

You would need to firstly rank your table visual based on Value field, then compare the rank value to the position value to get expected row.

Regards,
Lydia

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors