Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All,
I've been tasked with recreating an excel sheet in Power BI.
One of the formulas used in the excel is a nested vlookup, =VLOOKUP(VLOOKUP((('P50'!H13/('Month Hours'!$B$8))/8),RWS!$A:$B,1,TRUE),RWS!$A:$B,2,FALSE)
In Power BI the P50 is a measure, Month Hours is a column in my Calendar table and RWS A:B is now the columns Power KW and Windspeed KMS in a seperate table.
I want to take the value returned from the first part of the VLOOKUP so (P50/month hours)/8 and look that up aaginst the PowerKW column and then return the windspeed KMS column. I'm not sure it's possible to do in Power BI.
Thanks in advance,
Mike
Solved! Go to Solution.
hi @Anonymous ,
try below measure
IntermediateValue = DIVIDE([P50 Measure], MAX('Calendar'[Month Hours])) / 8
ClosestPowerKW =
VAR TargetValue = [IntermediateValue]
RETURN
MINX(
TOPN(
1,
FILTER(
'RWS',
ABS('RWS'[Power KW] - TargetValue) =
MINX(
FILTER('RWS', ABS('RWS'[Power KW] - TargetValue) >= 0),
ABS('RWS'[Power KW] - TargetValue)
)
),
ABS('RWS'[Power KW] - TargetValue),
ASC
),
'RWS'[Power KW]
)
ResultWindspeedKMS =
VAR ClosestKW = [ClosestPowerKW]
RETURN
MAXX(
FILTER('RWS', 'RWS'[Power KW] = ClosestKW),
'RWS'[Windspeed KMS]
)
@Anonymous
Create a measures
Intermediate Value =
DIVIDE(
DIVIDE([P50], MAX('Calendar'[Month Hours])),
8
)
Closest Power KW =
MAXX(
TOPN(
1,
FILTER(
'RWS',
'RWS'[Power KW] <= [Intermediate Value]
),
'RWS'[Power KW],
DESC
),
'RWS'[Power KW]
)
Resulting Windspeed KMS =
MAXX(
FILTER(
'RWS',
'RWS'[Power KW] = [Closest Power KW]
),
'RWS'[Windspeed KMS]
)
💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn
Hi @Anonymous ,
First, Create a measure to calculate (P50 / Month Hours) / 8
First Lookup Value =
DIVIDE(
DIVIDE([P50], MAX('Calendar'[Month Hours])),
8
)
Create a measure to find the closest value in the PowerKW column:
Closest PowerKW =
VAR TargetValue = [First Lookup Value]
RETURN
CALCULATE(
MAX('RWS'[PowerKW]),
FILTER(
'RWS',
'RWS'[PowerKW] <= TargetValue
)
)
Create another measure to return the corresponding Windspeed KMS
Result Windspeed =
VAR ClosestPower = [Closest PowerKW]
RETURN
CALCULATE(
MAX('RWS'[Windspeed KMS]),
'RWS'[PowerKW] = ClosestPower
)
Now, you can use the Result Windspeed measure in your visuals to display the calculated windspeed for each context.
hi @Anonymous ,
try below measure
IntermediateValue = DIVIDE([P50 Measure], MAX('Calendar'[Month Hours])) / 8
ClosestPowerKW =
VAR TargetValue = [IntermediateValue]
RETURN
MINX(
TOPN(
1,
FILTER(
'RWS',
ABS('RWS'[Power KW] - TargetValue) =
MINX(
FILTER('RWS', ABS('RWS'[Power KW] - TargetValue) >= 0),
ABS('RWS'[Power KW] - TargetValue)
)
),
ABS('RWS'[Power KW] - TargetValue),
ASC
),
'RWS'[Power KW]
)
ResultWindspeedKMS =
VAR ClosestKW = [ClosestPowerKW]
RETURN
MAXX(
FILTER('RWS', 'RWS'[Power KW] = ClosestKW),
'RWS'[Windspeed KMS]
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 39 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 25 |