Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Expression.Error: We cannot convert a value of type Record to type Number.
Details:
Value=[Record]
Type=[Type]
How to remove the error. I want to replace the NA value with a random number between its above and below value hee i used this code
let
ReplaceNullWithValue = (value, above, below) =>
if value = null then
if above <> null and below <> null then Number.RandomBetween(above, below)
else if above <> null then above
else if below <> null then below
else null
else
Text.From(value)
in
ReplaceNullWithValue([Value], try [Value]{[Index]-1}, try [Value]{[Index]+1})
please help me
Can you share your pbix file ?
Try the following :
let
Source = ..., // Your data source here
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1),
ReplaceNullWithValue = (value, above, below) =>
if value = null then
if above <> null and below <> null then Number.RandomBetween(above, below)
else if above <> null then above
else if below <> null then below
else null
else
try Number.From(value) otherwise value,
#"Custom Column" = Table.FromRecords(
Table.TransformRows(#"Added Index", each
Record.TransformFields(_,{
{"Value", each ReplaceNullWithValue(_, try #"Added Index"{[Index]-1}[Value] otherwise null, try #"Added Index"{[Index]+1}[Value] otherwise null)}
})
)
)
in
#"Custom Column"
New error :
Expression.Error: The field 'Value' of the record wasn't found.
Details:
Name=Sheet1
Data=[Table]
Item=Sheet1
Kind=Sheet
Hidden=FALSE
Index=0
You have to change the codition to NA instead of null, these are two different values.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Rohit001 I think you need this:
let
ReplaceNullWithValue = (value, above, below) =>
if value = null then
if above <> null and below <> null then Number.RandomBetween(above, below)
else if above <> null then above
else if below <> null then below
else null
else
Text.From(value)
in
ReplaceNullWithValue([Value], try #"Added Index"{[Index]-1}[Value] otherwise null, try #"Added Index"{[Index]+1}[Value] otherwise null)
change #"Added Index" name with the previous step when you are adding this new custom column
👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
But it still showing a null value
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 46 | |
| 42 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 196 | |
| 126 | |
| 101 | |
| 67 | |
| 49 |