Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
ashmitp869
Responsive Resident
Responsive 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.

ashmitp869_0-1732591635833.png

The data I have like :

ashmitp869_1-1732591813953.png

 

 

 

1 ACCEPTED SOLUTION

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
        )
    )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
danextian
Super User
Super 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/1447... 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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
        )
    )

danextian_0-1732598675891.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian Thanks the expressions worked and also getting TOTAL. But how to omit the Last line 

 

Becoz the TOTAL is duplicating , I don't need to show the last line instead show the TOTAL.

ashmitp869_0-1732608808984.png

Open Commitments = VAR _labour =
    SUM ( CommittedCostSummary[LaborOpenCommittedCost] )
VAR _allowance =
    SUM ( CommittedCostSummary[AllowanceOpenCommittedCost] )
VAR _fees =
    SUM ( CommittedCostSummary[FeesOpenCommittedCost] )
VAR _fom =
    SUM ( CommittedCostSummary[FOMRentedEquipmentOpenCommittedCost] )
VAR _sub =
    SUM ( CommittedCostSummary[SubcontractOpenCommittedCost] )
VAR _sup =
    SUM ( CommittedCostSummary[SuppliesOpenCommittedCost] )
VAR _mat =
    SUM ( CommittedCostSummary[MaterialsOpenCommittedCost] )
    VAR _equi =
    SUM ( CommittedCostSummary[ConstructionEquipmentOpenCommittedCost] )
VAR _unde =
    SUM ( CommittedCostSummary[UndefinedOpenCommittedCost] )
VAR _costcategory =
    SELECTEDVALUE ( CostCategory[Cost Category] )
RETURN
    IF (
        ISBLANK( _costcategory ),
        _labour + _allowance + _fees + _fom + _sub + _sup + _mat + _equi + _unde,
        SWITCH (
            TRUE (),
            _costcategory = "Labour", _labour,
            _costcategory = "Allowance", _allowance,
            _costcategory = "Fees", _fees,
            _costcategory = "FOM Rented Equipment", _fom,
            _costcategory = "Subcontractors", _sub,
            _costcategory = "Construction Supplies", _sup,
            _costcategory = "Project Materials", _mat, 
             _costcategory = "Plant & Equipment", _equi,
            _costcategory = "Undefined", _unde
            
        
        )
    )

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
        )
    )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.