Forum Discussion
ashmitp869
1 year agoResponsive Resident
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 :
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 ) )
5 Replies
- danextianSuper User
Hi ashmitp869
As always, please provide a workable sample data and not an image and your expected result from that - how it is to be computed, etc. Please refer to this post: https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- ashmitp869Responsive Resident
- danextianSuper User
Try this:
Open Commitments_ = VAR _labour = SUM ( CommittedCostSummary[LaborOpenCommittedCost] ) VAR _allowance = SUM ( CommittedCostSummary[AllowanceOpenCommittedCost] ) VAR _costcategory = SELECTEDVALUE ( CostCategory[Cost Category] ) RETURN IF ( ISBLANK ( _costcategory ), _labour + _allowance, SWITCH ( TRUE (), _costcategory = "Labour", _labour, _costcategory = "Allowance", _allowance ) )