Forum Discussion

pfarahani's avatar
pfarahani
Icon for Helper II rankHelper II
5 years ago
Solved

Measure for Expenses Vs Budget

Hello,    I have a pretty simple table in Power BI. It shows the actual expenses in one column and the budget for that year in the other column. I am trying to create a third column which shows the...
  • v-henryk-mstf's avatar
    5 years ago

    Hi pfarahani ,

     

    According to your description, whether it is column or measure, a field type can only be the same. Therefore, even if the judgment condition is used, the result of percentage and numeric value cannot be displayed in the same column.

     

    Two different results can only be obtained in the following ways, refer to the following:

    Measure = 
    var a = CALCULATE(SUM('Table'[Actual Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
    var b = CALCULATE(SUM('Table'[Budget Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
    return
    IF(b>a,(b-a)/b,0)

    Measure = 
    var a = CALCULATE(SUM('Table'[Actual Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
    var b = CALCULATE(SUM('Table'[Budget Expense]),ALLEXCEPT('Table','Table'[Fiscal Year]))
    return
    IF(b>a,0,-(b-a))


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


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