Forum Discussion

GarlonYau's avatar
GarlonYau
Icon for Helper I rankHelper I
2 years ago
Solved

Comparing Budget Vs Actual in Matrix, getting "Cannot convert Value " of type Text to type Numeric"

Hi folks!   I've got a data set around Revenue numbers for an organization, with Actual numbers and Budget numbers.   1) I've unpivoted each of these tables and combined these tables into 1 table...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi GarlonYau ,
    Based on your description, this appears to be an issue with text types and numeric types not converting to each other. The error you're experiencing may stem from the way Power BI handles division by zero, or a situation where the denominator (in this case ) is missing or equal to zero. When using the Divide function, the third argument provides a way to handle errors or division by zero. However, specifying the empty string ("") as an alternate result can sometimes lead to unexpected behavior, especially when Power BI requires a numeric value. You can modify the following dax to this

    Revenue / Day % Variance = 
    VAR BudgetPerDay = [Revenue Budget / Day]
    VAR ActualPerDay = [Revenue Actual / Day]
    RETURN
    IF(
        ISBLANK(BudgetPerDay) || BudgetPerDay = 0,
        BLANK(),
        DIVIDE(ActualPerDay - BudgetPerDay, BudgetPerDay)
    )

    For more details on using the divide function you can check out this documentation
    DIVIDE function (DAX) - DAX | Microsoft Learn

    Best regards,

    Albert He

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly