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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
OsmanBaba
New Member

Sum function not summing relatively

Hi,

 

I'm working on a dax function that conditions two columns and gives an output however one of my columns called hours doesn't seem to be Suming relatively when it's put in the calculated column.

 

Below is my DAx Measure

 

Color Code =
VAR LengthOfService = EssLeaveTimeOffDates[Months of Service]
VAR Hours = SUM(EssLeaveTimeOffDates[Hours])
VAR DebugInfo = " Hours: " & Hours
RETURN
    IF(
        LengthOfService >= 60,
        IF(
            Hours   >= 1464,
            "Red (" & DebugInfo & ")",
            IF(
                Hours   >= 732 && Hours < 1464,
                "Amber",
                "Default Color "  & DebugInfo & ")"
            )
        ),
        IF(
            LengthOfService >= 24 && LengthOfService < 60,
            IF(
                 Hours  >= 366 && Hours < 732,
                "Amber",
                IF(
                     Hours   >= 732,
                    "Red",
                    "Default Color"
                )
            ),
            IF(
                LengthOfService >= 6 && LengthOfService < 24,
                IF(
                     Hours  >= 188 && Hours < 376,
                    "Amber",
                    IF(
                         Hours  >= 376,
                        "Red",
                        "Default Color"
                    )
                ),
                IF(
                    LengthOfService < 6,
                    "Red",
                    "Default Color"
                )
            )
        )
    )
 
Here is the table as you can see I would need the hour value to be 1492 however it's summing all the hours and is 11863.63 I want it to sum relatively based on the row.
 
Capture.PNG
2 REPLIES 2
lbendlin
Super User
Super User

I want it to sum relatively based on the row.

Not clear to me what you mean by that. Can you show the expected result based on your sample data?

OsmanBaba
New Member

If anyone looking for the answer it was because i was trying to do it as a calculated column instead of a measure. Thank you

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.