SUM
What it does?
Adds all the numbers in a column.
Syntax
SUM([Column Name])
Returns
Decimal Number
What is the SUM function?
The SUM function in DAX is like the ultimate party planner! – it takes a list of numbers and adds them all together to give you one big total. Perfect for when you want to know how much fun you had at a party, or in data terms, how much sales your sales were last month!
Example 1: Candy Crush
Imagine you run a candy store, and you want to know how many candies you sold last week. Here’s how your sales data might look:
Day |
Candies Sold |
Monday |
100 |
Tuesday |
150 |
Wednesday |
200 |
Thursday |
250 |
Friday |
300 |
To find out how many candies you sold in total, you’d use the SUM function like this:
Total Candies = SUM(Sales[Candies Sold])
So how many candies did you sell? 100 + 150 + 200 + 250 + 300 = 1000! That’s a whole lot of sweet treats!
Example 2: Fantasy Football Frenzy
Picture this: you’re in a fantasy football league, and you want to calculate your Quarterback’s total passing yards for the season:
Game |
Points |
Game 1 |
184 |
Game 2 |
226 |
Game 3 |
254 |
To find your points scored:
Total Yards=SUM(League[Passing Yards])
Adding it up gives you 184 + 226 + 254 = 664 yards! Time to celebrate with some victory snacks!
Conclusion: Add It Up!
The SUM function in DAX is your trusty sidekick for adding things up, whether it’s candy sales, fantasy football statistics, or more. With just a simple function, you can turn data into insights and make your reports great!
So, what are you waiting for? Get SUMming!