Forum Discussion

ashmitp869's avatar
ashmitp869
Responsive Resident
1 year ago
Solved

Help with dax expressions

Hi , Can any one help  me with dax measures.I need to calculate Open Commitments against this Cost Category : Labour, Plant & Equipments etc. The data I have like :      
  • danextian's avatar
    danextian
    1 year ago

    Change your formula to below or you can simply just hide that blank category row.

    Open Commitments_ =
    VAR _labour =
        SUM ( CommittedCostSummary[LaborOpenCommittedCost] )
    VAR _allowance =
        SUM ( CommittedCostSummary[AllowanceOpenCommittedCost] )
    VAR _costcategory =
        SELECTEDVALUE ( CostCategory[Cost Category] )
    RETURN
        IF (
            NOT ( HASONEVALUE ( CostCategory[Cost Category] ) ),
            _labour + _allowance,
            SWITCH (
                TRUE (),
                _costcategory = "Labour", _labour,
                _costcategory = "Allowance", _allowance
            )
        )