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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.