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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Adrian_Celis
Regular Visitor

Aggregating using DAX

Hi Everyone,

I'm a little new to Power BI. I have this table called 'PurchaseOrders' with columns 'ResellerID', 'Date' and 'PO Total VAT Ex'.

Adrian_Celis_1-1695243224754.png

What I want to do is get:

1. the sum of all 'PO Total VAT Ex' for each ResellerID and each YEAR.

2. the count of items for each ResellerID and each YEAR.


My first thought of how to do this is create another query and then use Group By on on Power Query. Which works but then I have to create 2 new queies. I am thinking this is not the best way to do it.

 

Now I am thinking of creating a measure on the table instead. But I am not yet familiar with DAX. So

I ask if the 'measure' approach is correct and how do I write the DAX formula for each one?

 

Thank you very much!

Adrian

1 ACCEPTED SOLUTION

Create a date dimension table and establish a relationship to your date column. Make your reseller ID data type of text. Create two measures:
Total VAT = SUM( Vat Column )
Item Count = COUNT( Item Column ) or if you want unique item count, DISTINCTCOUNT

Then on your report canvas, drag the Year column from your date table, the Reseller ID column, and your two measures into the visual of your choice. 

*There are some awesome Power BI 101 videos online which will give you the foundation you need. Good luck!

View solution in original post

4 REPLIES 4
Idrissshatila
Super User
Super User

Hello @Adrian_Celis ,

 

check how to use sum and count using dax from the following links
https://learn.microsoft.com/en-us/dax/sum-function-dax

https://learn.microsoft.com/en-us/dax/count-function-dax

 

and in your case here

Sum of total PO = sum ( 'YourTableName' [PO Total VAT Ex])

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin
Vote for my Community Mobile App Idea 💡



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Hi @Idrissshatila 

Thank you for your reply. So I assume you mean the measure approach is the right way to do it.
I have already came accross the sum and count functions but as asked above, how do you aggregate with these conditions:

1. the sum of all 'PO Total VAT Ex' for each ResellerID and each YEAR.

2. the count of items for each ResellerID and each YEAR.

 

Thank you

Adrian

Create a date dimension table and establish a relationship to your date column. Make your reseller ID data type of text. Create two measures:
Total VAT = SUM( Vat Column )
Item Count = COUNT( Item Column ) or if you want unique item count, DISTINCTCOUNT

Then on your report canvas, drag the Year column from your date table, the Reseller ID column, and your two measures into the visual of your choice. 

*There are some awesome Power BI 101 videos online which will give you the foundation you need. Good luck!

Hi @CoreyP 
Thank you! It seems to work and simpler than I thought.

I was overthinking that the formula should be something like Sum of PO Total VAT Ex filtered by current item's year and reseller ID. But you just have to drag them in the report canvas.
Thanks for the help.

 

Regards,

Adrian

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.