Forum Discussion
Dax Query - Assistance Between Argument
Good day All
I am strungling with formulating the below Dax query. PLease could you advise?
If the [Actual Diameter] is between Column [Diam1] and Column [Diam2], then the diameter is equal to the value in Column [IsDiam].
In Excel I would use a Vlookup to do this =VLOOKUP([@[Actual Diameter]],DataTables!$N$3:$P$48,3,1).
What will the equivalent Dax syntax be?
Hi,
This calculated column formula works
Real Diameter =
CALCULATE(MIN(Ranges[IsDiam]),FILTER(Ranges,Ranges[Diam1]<=EARLIER(Data[Actual Diameter])&&Ranges[Diam2]>=EARLIER(Data[Actual Diameter])))
Hope this helps.
6 Replies
- Fowmy
Super User
Daniel_Mostert
You can use LOOKUPVALUE function in DAX:
https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax
Share sample data from both the tables and the expected results if you cannot complete it. - Daniel_MostertRegular Visitor
- Fowmy
Super User
Daniel_Mostert
Better create a new question with the same content and include more details and samples.
- Daniel_MostertRegular Visitor
ActualDiameter
9.6
16.11
21.86
21.06
18.08Diam1 Diam2 IsDiam
0 12.9 11
13 14.9 13
15 16.9 15
17 18.9 17
19 20.9 19
21 22.9 21RealDiameter
11
15
2121
17- Ashish_Mathur
Super User
Hi,
This calculated column formula works
Real Diameter =
CALCULATE(MIN(Ranges[IsDiam]),FILTER(Ranges,Ranges[Diam1]<=EARLIER(Data[Actual Diameter])&&Ranges[Diam2]>=EARLIER(Data[Actual Diameter])))
Hope this helps.
- AnonymousNot applicable
Hi Daniel_Mostert ,
From your description, it seems that you want to use DAX functions to return the same output as when use VLOOKUP() in Excel, right?
But sorry for that I could not get enough useful information to make the problem very clear to me.
Please provide me with more details (such as some screenshots)about your table and the expected output in Table format or share me with your pbix file after removing sensitive data.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.