I have total sales amount but I need a column where I get total of sales per city and per month using dax function

Vishal Shendge 0 Reputation points
2024-12-24T16:10:50.1466667+00:00

I have a data showing total sales. Can I get new column where I can see the total of sales per city using dax function.

This question is related to the following Learning Module

Microsoft Power Platform Training
Microsoft Power Platform Training
Microsoft Power Platform: An integrated set of Microsoft business intelligence services.Training: Instruction to develop new skills.
507 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Syed Saleem Peera 9,620 Reputation points Microsoft Vendor
    2024-12-26T04:09:42.5966667+00:00

    Hi Vishal Shendge,

    Thank you for reaching out to us on the Microsoft Q&A forum.

    I have created the necessary DAX expressions to calculate the total sales per city and per month. Here's how it's done:

    Total Sales per City: Using the DAX formula, we calculate the total sales for each city by removing any filters except for the city column. This gives the total sales specific to each city.

    Formula for Total Sales per City:

    Total Sales per City =

    CALCULATE(SUM([Sales]),

    ALLEXCEPT('Table Name', 'Table Name'[City Column])

    )

    Total Sales per Month: Similarly, to calculate the total sales for each month, I have used a DAX expression that removes all filters except for the month column, allowing us to get the sales totals for each month.

    Formula for Total Sales per Month:

    Total Sales per Month =

    CALCULATE(SUM([Sales]),

    ALLEXCEPT('Table Name', 'Table Name'[Month Column])

    )

    This approach ensures that you can view the total sales dynamically based on either the city or month, and it updates based on the filters you apply in your reports.

    If you are still facing any issue, please let us know in the comments and where you are encountering this error along with the screenshot for reference. We are glad to help you.

    If you found the information helpful, we would greatly appreciate it if you could acknowledge it by selecting the Accept Answer & Upvote options.

    Thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.