Forum Discussion
Null Count & Percentage
Hi All,
I'm an Enterprise Data Architect who's new to PowerBI, I'm used to SQL and excel functions and writing the simplest thing is v. frustrating - any help is most appreciated.
I've got a table, i'm wanting to count number of {a particular column value, e.g. 1234567} and then caculate as a % of total table count.
Example: Column A has 5 instance of value 1234567 and there are 100 rows in table, so = 5%
Would use count, group by's and ctes in SQL Server, scratching my head here.
Cheers,
Andy R
you can use Percent of grand total option in visuals or create a measure like
Measure = DIVIDE( CALCULATE(COUNTROWS(Table), Table[Value] = "1234567"), CALCULATE(COUNTROWS(Table), ALL(Table)) )Hi Andybr ,
check this.
Measure = DIVIDE(COUNTROWS(FILTER('Table','Table'[Column] = 1234567)),COUNTROWS('Table'))https://docs.microsoft.com/en-us/dax/divide-function-dax
https://docs.microsoft.com/en-us/dax/countrows-function-dax
https://docs.microsoft.com/en-us/dax/filter-function-dax
5 Replies
- az38
Community Champion
you can use Percent of grand total option in visuals or create a measure like
Measure = DIVIDE( CALCULATE(COUNTROWS(Table), Table[Value] = "1234567"), CALCULATE(COUNTROWS(Table), ALL(Table)) )- mwegener
Most Valuable Professional
- mwegener
Most Valuable Professional
Hi Andybr ,
check this.
Measure = DIVIDE(COUNTROWS(FILTER('Table','Table'[Column] = 1234567)),COUNTROWS('Table'))https://docs.microsoft.com/en-us/dax/divide-function-dax
https://docs.microsoft.com/en-us/dax/countrows-function-dax
https://docs.microsoft.com/en-us/dax/filter-function-dax