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
LizziePeters
Helper I
Helper I

sumifs in Power BI

Hi, I am trying to work out a way to sum up some values in a column if based on 2 or more criteria.

Using the below example, I would like to create a formula that sums the 'total rights' column IF the Year is 2019 and the Deal ID is 34.

 

Thank you so much for your help!

 

LizziePeters_1-1602750171564.png

 

 

1 ACCEPTED SOLUTION

Hi @LizziePeters ,

You can create two slicers base on field Year and Deal ID and create the related visual using the aggregate (Sum) of field Total Rights just as below screenshot.

sumifs in Power BI.png

Best Regards
Rena
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

Community Support Team _ Rena
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

4 REPLIES 4
amitchandak
Super User
Super User

@LizziePeters , Try as measure or column

 

sumx(filter(Table, Table[year] =2019 && Table[deal Id] =34),Table[total rights])

Thank you so much for the quick response!  How about if I want to do this for a much wider dataset?  Ie I don't want to mention "2019" and "34" in my formula?  I would just like the formula to look at the cells in that given column?  Thank you so much!

Hi @LizziePeters ,

You can create two slicers base on field Year and Deal ID and create the related visual using the aggregate (Sum) of field Total Rights just as below screenshot.

sumifs in Power BI.png

Best Regards
Rena
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.

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

@LizziePeters ,

 

sumx(filter(Table, Table[year] =year(today())-1 && Table[deal Id] =34),Table[total rights])

for [deal Id]  you can use slicer

 

Or use time intelligence

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
//Only year vs Year, not a level below

 


This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

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.