Do you absolutely need to do this through DAX? The query editor is very easy to use. You can get the same results by selecting
Edit Queries -> right click on your table and select Duplicate -> Go to the newly duplicated table and left click on col a and select Group By -> Group by col a and select Sum under Operation
This will give you the results that you want. If you have to do it through DAX via a calculated table, I can provide instructions for that as well, just let me know.
You will select New Table -> The formula will be the following:
col a = DISTINCT(Table1[col a])
You will then go to the Relationships tab and form a relationship between the col a of both tables.
Then return to the new table and select New Column -> The formula will be:
Col b := CALCULATE(SUM(Table1[col b]))
Where Table1 is the original table name.
Did you form a relationship between the two tables? If you did not then you are going to get the sum total for all value in col a. After forming the relationship, you get the following:
The solution that @v-xjiin-msft posted should also work as well.
Visit our Community Blog for articles, guides, and information created by fellow community members.
Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.
Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!
Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications