Forum Discussion

AAMW01's avatar
AAMW01
Helper I
4 years ago
Solved

Get individual values from table1 where table1 column = table 2 column then sum

I have this table: Rows: Overhead Types Columns: Fiscal Year Values: Overhead Cost (from database) Budget Values (from excel) Each link to the calendar table.    The values from the databa...
  • AAMW01's avatar
    4 years ago

    I have fixed my own issue. 

     

    The problem was for some reason the query is using Max / Min from the string comparison cells and using that to calculate total value . Not sure why it does that because I used SUM (value) and my filter used MAX(group type) comparison.

     

    I changed the first measure to this:

    Overhead Budget Calc = 
    CALCULATE(
        SUM('BudgetData21-22'[Value]), 
        FILTER('BudgetData21-22', 'BudgetData21-22'[GroupType] = SELECTEDVALUE('cwDashOverHeads-KPI10'[OverheadType]))
        )

     

    This made the total blank which I then used an if else statement to do a conditional calculation.

     

    total sum OH = 
    IF(ISBLANK(CALCULATE('cwDashOverHeads-KPI10'[Overhead Budget Calc])), CALCULATE(SUM('BudgetData21-22'[Value])), [Overhead Budget Calc])

     

    Works perfectly. 

     

    Thanks to those who tried to help.