Search code examples
powerbipowerbi-datasource

Power BI : How to count occurrence of value from source table?


I have my data source something like below.

enter image description here

I need to show output in the report as below.

enter image description here

I tried using the unpivot column and getting something like this, how to count the occurrence value of each Business value.

enter image description here


Solution

  • We have to remove the Attribute column as the next step to Unpivot. Then my table should be looks like this.

    enter image description here

    Now create a new table with following Dax function, let's say the current table as Business Data (Your Unpivot table)

    Occurrence Table = DISTINCT('Business Data')
    

    Now end result table should look like this,

    enter image description here

    You can make use of this table for your table visual in the report.

    Note: You can add n-number of rows and column into your source table and this logic will do magic to get the correct result.