How To Calculate Percentage Power Bi

To calculate a percentage in Power BI, you can use the DAX (Data Analysis Expressions) language. DAX provides functions that allow you to perform calculations on your data.

Here is an example of calculating a percentage in Power BI:

    
      Percentage = DIVIDE([Sales], [Total Sales])
    
  

In this example, we are dividing the ‘Sales’ measure by the ‘Total Sales’ measure to calculate the percentage. The DIVIDE function is used to handle scenarios where the divisor might be zero, preventing any division errors.

You can then drag and drop the ‘Percentage’ measure in your visualization to display the calculated percentage.

Another example of calculating a percentage is by using the CALCULATE function along with the SUMX function. Let’s say you have a table of sales data and you want to calculate the percentage of each product’s sales to the total sales.

    
      Percentage = DIVIDE(
        SUMX(SalesData, SalesData[Sales]),
        CALCULATE(SUM(SalesData[Sales]), ALL(SalesData))
      )
    
  

In this example, the SUMX function performs a summation of the sales for each product in the SalesData table. The CALCULATE function is used to remove any filters on the SalesData table and calculate the total sales across all products using the SUM function. The DIVIDE function then calculates the percentage by dividing the product sales by the total sales.

These are just a couple of examples of how you can calculate percentages in Power BI. The DAX language provides a wide range of functions that can be used to perform complex calculations on your data.

Read more interesting post

Leave a comment