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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
yasmin
Advocate II
Advocate II

Sumif and averageif

Good Morning! I have been using PowerBi recently and I still have difficulty performing some operations that I believe are basic.

I am looking for which function to use in Power BI, which has the same result as SUM.IF (S) and AVERAGE.IF in excel so that it is not necessary to write the condition, but to read the cell condition of a column of the corresponding row.

Just explaining what I'm trying to do I have the following tables:
1) PRODUCTS: where I have the registration of each product (one per line), they appear only once with their respective information.
2) Sales: where I have the following columns STORE, TICKET, DATE, PRODUCT, REVENUE, QTD. It is basically a sales history with the sale of each product per store per ticket.
3) Inventory stores: Has the columns STORE, PRODUCT, QTD. Shows how much in stock I have for each product per store.

I am trying to create two measures:
(a) one calculating the average sales of a product in the last four months
b) a measure that sums the total inventory of the product (adding all stores)
In this case, the key collumn would be the PRODUCT column

 

Thank you!

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @yasmin

 

You may try to use CALCULATE Function or AVERAGEX Function. Here is the document for you. If it is not your case, please share some data sample and expected output. You can upload it to OneDrive or Dropbox and post the link here.

 

https://powerpivotpro.com/2009/12/powerpivot-dax-calculate-is-a-supercharged-sumif/

https://community.powerbi.com/t5/Desktop/Average-of-last-6-months/td-p/128738

 

Regards,

Cherie

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

1 REPLY 1
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @yasmin

 

You may try to use CALCULATE Function or AVERAGEX Function. Here is the document for you. If it is not your case, please share some data sample and expected output. You can upload it to OneDrive or Dropbox and post the link here.

 

https://powerpivotpro.com/2009/12/powerpivot-dax-calculate-is-a-supercharged-sumif/

https://community.powerbi.com/t5/Desktop/Average-of-last-6-months/td-p/128738

 

Regards,

Cherie

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.