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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ferbyrez
Helper II
Helper II

"Sumifs" in the same column - multiple criterias

Hi guys,

 

I have a table and I need to sum different criterias in the same column and 1 criteria in other column.

 

My table:

YEAR | Month | Value

2018  | Jan      | 100

2019  | Jan      | 10

2019  | Feb      | 20

2019  | Apr      | 50

2018  | Feb     | 25

2019  | Mar    | 70

 

I want to sum for the criterias:
[YEAR] = 2019

[MONTH] = Jan, Feb and Mar

Total:  100

 

I tried this, but it´s not working:

 

CALCULATE(SUM(Fato_PacoteRE[Value]);Fato_PacoteRE[YEAR] ="2019"; Fato_PacoteRE[Month] = "Jan" || Fato_PacoteRE[Month] = "Feb"))

 

thanks in advance for helping 🙂

 

 

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hiferbyrez,

 You could try below measure

Sales 3 Month =
CALCULATE (
    SUM ( sumif[value] ),
    FILTER (
        sumif,
        sumif[year] = 2019
            && ( sumif[month] = "Jan"
            || sumif[month] = "Feb"
            || sumif[month] = "Mar" )
    )
)

269.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

Try like this

Sales 3 Month = CALCULATE(sum(Sales[Sales Amount]),year(Sales[Sales Date])=2019 && (month(Sales[Sales Date])=1||month(Sales[Sales Date])=2 ||month(Sales[Sales Date])=3))

Hi, thanks for helping.

 

I´m not associating to a calendar table, but used your ideia and the result is:

 

Aluguéis REAL 19 = CALCULATE(SUM(Fato_PacoteRE[Valor]); Fato_PacoteRE[Ano] = "2019" && Fato_PacoteRE[Mês]="Janeiro" || Fato_PacoteRE[Mês]="Fevereiro")

 

The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.

dax
Community Support
Community Support

Hiferbyrez,

 You could try below measure

Sales 3 Month =
CALCULATE (
    SUM ( sumif[value] ),
    FILTER (
        sumif,
        sumif[year] = 2019
            && ( sumif[month] = "Jan"
            || sumif[month] = "Feb"
            || sumif[month] = "Mar" )
    )
)

269.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

many thanks everyone !! It´s working now 🙂

Use function like Year and month on a date column then it will not give that issue. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.