Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
aslf
New Member

OLE DB or ODBC error: Query cannot convert value " of type text to type Numeric/Date

Hi, I'm trying to create a DAX for a variance with arrows (UNICHAR) but I'm giving the following error: OLE DB or ODBC error: Query cannot convert value " of type text to type Numeric/Date. Is happening specially for values where is empty. But that can happen at any point as I'm working with a live connection. This is my code:

Act to Bud Var % arrow (RPOK) =
VAR _uparrow = UNICHAR(129129)
VAR _downarrow = UNICHAR(129131)
VAR target = [RPOK (budget)]
VAR actuals = [RPOK]
VAR vari = DIVIDE(actuals - target, target, 0)
VAR _varpercentage = ROUND(vari * 100, 2) & "%"
RETURN
    IF(
        vari > 0,
        _varpercentage & _uparrow,
        _varpercentage & _downarrow
    )

I'll really appreciate any guidance in fixing my code! Thank you!
1 ACCEPTED SOLUTION
Shravan133
Super User
Super User

Replace your blanks with 0. either do it at the source level or in your dax.

Act to Bud Var % arrow (RPOK) =
VAR _uparrow = UNICHAR(129129) -- Up arrow
VAR _downarrow = UNICHAR(129131) -- Down arrow
VAR target = COALESCE([RPOK (budget)], 0) -- Replace blank with 0
VAR actuals = COALESCE([RPOK], 0) -- Replace blank with 0
VAR vari = DIVIDE(actuals - target, target, 0) -- Avoid division errors
VAR _varpercentage = ROUND(vari * 100, 2) & "%"

RETURN
IF(
vari > 0,
_varpercentage & " " & _uparrow,
_varpercentage & " " & _downarrow
)

View solution in original post

1 REPLY 1
Shravan133
Super User
Super User

Replace your blanks with 0. either do it at the source level or in your dax.

Act to Bud Var % arrow (RPOK) =
VAR _uparrow = UNICHAR(129129) -- Up arrow
VAR _downarrow = UNICHAR(129131) -- Down arrow
VAR target = COALESCE([RPOK (budget)], 0) -- Replace blank with 0
VAR actuals = COALESCE([RPOK], 0) -- Replace blank with 0
VAR vari = DIVIDE(actuals - target, target, 0) -- Avoid division errors
VAR _varpercentage = ROUND(vari * 100, 2) & "%"

RETURN
IF(
vari > 0,
_varpercentage & " " & _uparrow,
_varpercentage & " " & _downarrow
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors