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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
tberr86
Frequent Visitor

Calculating sum of costs by project and activity

Hello community,

 

Working on a schedule of costs report that will show budgeted cost of each activity but am beyond my DAX experience. One table (ScheduleCosts) holds the grouping of costs by activity. One table (HomeBudget) holds the homes budgeted cost. One table (HomeSchedule) holds the date of completion for each activity. Sample data below, example of intended result in CALCULATED AMOUNT column. I think I need to create a Calculated table that filters the costs to the selected record's activity, then SUMs the budgeted amount filtered by Home and costs in the filtered calculated table. 

 

tberr86_0-1693243050566.png

 

I appreciate the assistance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tberr86 ,

You can create a measure as below to get it, please find the details in the attachment.

Calculated Amount = 
VAR _devhouse =
    SELECTEDVALUE ( 'HomeSchedule'[Devhouse] )
VAR _activitycode =
    SELECTEDVALUE ( 'HomeSchedule'[activitycode] )
VAR _costcodes =
    CALCULATETABLE (
        VALUES ( ScheduleCosts[Cost-Code] ),
        FILTER ( 'ScheduleCosts', 'ScheduleCosts'[activitycode] = _activitycode )
    )
VAR _amount =
    CALCULATE (
        SUM ( 'HomeBudget'[budgetamount] ),
        FILTER (
            'HomeBudget',
            'HomeBudget'[DEVHOUSE] = _devhouse
                && 'HomeBudget'[Cost-Code] IN _costcodes
        )
    )
RETURN
    _amount

vyiruanmsft_0-1693365977829.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @tberr86 ,

You can create a measure as below to get it, please find the details in the attachment.

Calculated Amount = 
VAR _devhouse =
    SELECTEDVALUE ( 'HomeSchedule'[Devhouse] )
VAR _activitycode =
    SELECTEDVALUE ( 'HomeSchedule'[activitycode] )
VAR _costcodes =
    CALCULATETABLE (
        VALUES ( ScheduleCosts[Cost-Code] ),
        FILTER ( 'ScheduleCosts', 'ScheduleCosts'[activitycode] = _activitycode )
    )
VAR _amount =
    CALCULATE (
        SUM ( 'HomeBudget'[budgetamount] ),
        FILTER (
            'HomeBudget',
            'HomeBudget'[DEVHOUSE] = _devhouse
                && 'HomeBudget'[Cost-Code] IN _costcodes
        )
    )
RETURN
    _amount

vyiruanmsft_0-1693365977829.png

Best Regards

Thank you for the support on this! 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.