How To Calculate Current Year Sales In Power Bi

How to Calculate Current Year Sales in Power BI

In Power BI, you can calculate the current year’s sales by following these steps:

  1. Create a new measure to calculate the sum of sales for the current year:
  2. <measure name> = CALCULATE(
        SUM(<sales column name>),
        FILTER(
          <table name>,
          YEAR(<date column name>) = YEAR(NOW())
        )
      )

    Replace <measure name>, <sales column name>, <table name>, and <date column name> with the appropriate values from your dataset.

    This measure uses the CALCULATE function to sum the sales column based on a filter. The filter is set to include only the rows where the year of the date column matches the current year (obtained using the YEAR and NOW functions).

    For example, if your sales data is stored in a table called “Sales” and the sales amount is stored in a column called “Amount”, and the date of each sale is stored in a column called “Date”, the measure may look like this:

    Sales Current Year = CALCULATE(
        SUM(Sales[Amount]),
        FILTER(
          Sales,
          YEAR(Sales[Date]) = YEAR(NOW())
        )
      )
  3. You can now use the new measure in your Power BI report to display the current year’s sales.
  4. For example, you can add a card visual to your report and set its value to the “Sales Current Year” measure.

Similar post

Leave a comment