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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
walkra
Helper III
Helper III

ADD AS IN SUMIF DOES NOT WORK

Hi,  How are you. There is something that I am not doing well. I just want to do a sum as I do with SUMIF in Excel but in Power Bi.

I have a query where I want to add "Horas" according to the value of "Codigo Cliente". For example, in the attached image, in "Columna in the records of the "Client Code" TEC, the value 107855 should appear, but it gives an error or the same number appears in the record. It does not present the sum.

I have tried many formulas but none worked. Now I am using: 

Columna = CALCULATE(sum(Hoja1[Horas]),all(Hoja1[Codigo Cliente]))
(maybe my lack of English makes me make mistakes when I transfer what I understand to Power BI)
Thank You Very Much. Untitled.png
1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

You can go with this

CodeTotal = VAR _Code = Hoja1[Codigo Cliente]
            
RETURN
    CALCULATE(SUM([Horas]), 
        FILTER(Hoja1, Hoja1[Employee] = _Code))

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

You can go with this

CodeTotal = VAR _Code = Hoja1[Codigo Cliente]
            
RETURN
    CALCULATE(SUM([Horas]), 
        FILTER(Hoja1, Hoja1[Employee] = _Code))

Excellent! Thank You very much

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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