Skip to main content

20 Power BI Dax Measures


UserPower bi 20 dax measures 20 DAX (Data Analysis Expressions) measures in Power BI with examples:
  1. Total Sales:

    scss
    Total Sales = SUM(Sales[Amount])
  2. Average Sales Price:

    scss
    Avg Sales Price = AVERAGE(Sales[Amount])
  3. Total Units Sold:

    mathematica
    Total Units Sold = SUM(Sales[Quantity])
  4. Total Customers:

    scss
    Total Customers = COUNTROWS(Customer)
  5. Total Products:

    mathematica
    Total Products = COUNTROWS(Product)
  6. Maximum Sales Amount:

    scss
    Max Sales Amount = MAX(Sales[Amount])
  7. Minimum Sales Amount:

    scss
    Min Sales Amount = MIN(Sales[Amount])
  8. Sales Growth Percentage:

    mathematica
    Sales Growth % = (Total Sales - [Total Sales Last Year]) / [Total Sales Last Year]
  9. Total Profit:

    scss
    Total Profit = SUM(Sales[Profit])
  10. Total Orders:

    scss
    Total Orders = COUNTROWS(Orders)
  11. Total Customers with Sales:

    css
    Total Customers with Sales = COUNTROWS(FILTER(Customer, [Total Sales] > 0))
  12. Total Sales by Region:

    mathematica
    Total Sales by Region = SUMX(VALUES(Region[RegionName]), [Total Sales])
  13. Total Sales by Year:

    scss
    Total Sales by Year = SUMX(VALUES(Calendar[Year]), [Total Sales])
  14. Running Total Sales:

    scss
    Running Total Sales = SUMX(FILTER(ALL(Calendar), Calendar[Date] <= MAX(Calendar[Date])), [Total Sales])
  15. Top N Products by Sales:

    mathematica
    Top N Products by Sales = TOPN(5, ALL(Product), [Total Sales])
  16. Rolling Average Sales (3 Months):

    scss
    Rolling Avg Sales 3M = AVERAGEX(DATESYTD(Calendar[Date]), [Total Sales])
  17. Total Sales to Date:

    mathematica
    Total Sales to Date = TOTALYTD([Total Sales], Calendar[Date])
  18. Sales Rank by Product:

    mathematica
    Sales Rank by Product = RANKX(ALL(Product), [Total Sales], , DESC, Dense)
  19. Customer Churn Rate:

    css
    Customer Churn Rate = DIVIDE([Lost Customers], [Total Customers])
  20. Year-to-Date Growth:

    mathematica
    YTD Growth = DIVIDE([Total Sales], [Total Sales Last Year]) - 1

These measures cover a range of common calculations in Power BI, including basic aggregations, comparisons, and time-based calculations. You can adapt and customize them to suit your specific data and reporting needs

Comments

Popular posts from this blog

40 Power Query Editor features in Power BI

40 Power Query Editor features in Power BI along with examples: 1. Filter Rows: Remove rows based on conditions. Example: Remove rows with a null value in the "CustomerName" column. 2. Remove Duplicates: Eliminate duplicate rows. Example: Remove duplicate entries based on the "OrderID" column. 3. Sort Rows: Arrange rows in ascending or descending order. Example: Sort data by "Date" column in descending order. 4. Replace Values: Substitute one value with another. Example: Replace "N/A" with "Unknown" in the "Status" column. 5. Split Columns: Divide a column into multiple columns. Example: Split "FullName" into "FirstName" and "LastName." 6. Merge Queries: Combine data from multiple sources. Example: Merge customer and order data based on the "CustomerID." 7. Group By: Aggregate data based on a specific column. Example: Group sales data by "ProductCategory" and calculate the sum ...

Indirect Function

INDIRECT  is pretty cool for grabbing a value from a cell. Can  INDIRECT  point to a multi-cell range and be used in a  VLOOKUP  or  SUMIF  function?  You can build an  INDIRECT  function that points to a range. The range might be used as the lookup table in a  VLOOKUP  or as a range in  SUMIF  or  COUNTIF . In  Figure , the formula pulls data from the worksheets specified in row 4. The second argument in the  SUMIF  function looks for records that match a certain date from column A. Note:  Because each worksheet might have a different number of records, I chose to have each range extend to 300. This is a number that is sufficiently larger than the number of transactions on any sheet. The formula in cell B5 is: =SUMIF(INDIRECT(B$4&"!A2:A300"), $A5, INDIRECT(B$4&"!C2:C300")) Summary:  You can use  INDIRECT  to grab data from a multi-cell range.

Year Over Year calculation using Pivot Table

Instead of creating a formula outside of the pivot table, you can do this inside the pivot table. Start from the image with column D empty. Drag Revenue a second time to the Values area. Look in the Columns section of the Pivot Table Fields panel. You will see a tile called Values that appears below Date. Drag that tile so it is below the Date field. Your pivot table should look like this: Double-click the Sum of Revenue2 heading in D4 to display the Value Field Settings dialog. Click on the tab for Show Values As. Change the drop-down menu to % Difference From. Change the Base Field to Date. Change the Base Item to (Previous Item). Type a better name than Sum of Revenue2 - perhaps % Change. Click OK. You will have a mostly blank column D (because the pivot table can't calculate a percentage change for the first year. Right-click the D and choose Hide.