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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.