Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

percentage of column with text values

Hi there

 

Probably an easy one for the seasoned PowerBi developer. I'm a newbie.

we looking to find percentage for column status where value is "OnTime". I already have a table for date dimension which we'll use to visualize data by month

 

DateStatus
01-MarOnTime
04-MarLate
04-AprUndetermined
07-AprLate
05-JunOnTime
08-JulOnTime
01-AugLate
03-AugUndetermined
2 ACCEPTED SOLUTIONS
PC2790
Community Champion
Community Champion

Hello,

 

You can use this DAX measure to achieve it:

%OnTimeStatus = DIVIDE(CALCULATE(COUNTA(StatusTable[Status]),FILTER(StatusTable,StatusTable[Status] = "OnTime")),CALCULATE(COUNTA(StatusTable[Status]),ALLEXCEPT(StatusTable,StatusTable[Status])))

Also ensure to click on the measure & change the format to percentage.

This will give you the percentage of On Time on the basis of total rows in your table.

 

I hope I interpreted your requirement correctly.

Please respond back if you are looking for something else 

View solution in original post

PC2790
Community Champion
Community Champion

Sure you can. Both will work for you.

Infact COUNTROWS will give more efficient result for you.

View solution in original post

9 REPLIES 9
PC2790
Community Champion
Community Champion

Hello,

 

You can use this DAX measure to achieve it:

%OnTimeStatus = DIVIDE(CALCULATE(COUNTA(StatusTable[Status]),FILTER(StatusTable,StatusTable[Status] = "OnTime")),CALCULATE(COUNTA(StatusTable[Status]),ALLEXCEPT(StatusTable,StatusTable[Status])))

Also ensure to click on the measure & change the format to percentage.

This will give you the percentage of On Time on the basis of total rows in your table.

 

I hope I interpreted your requirement correctly.

Please respond back if you are looking for something else 

Anonymous
Not applicable

Could i have used 

%OnTimeStatus = DIVIDE(CALCULATE(COUNTROWS(StatusTable),StatusTable[Status] = "OnTime"),CALCULATE(COUNTROWS(StatusTable)))

THis seems to give me a different result which looks more accurate tho
PC2790
Community Champion
Community Champion

Sure you can. Both will work for you.

Infact COUNTROWS will give more efficient result for you.

Anonymous
Not applicable

This has been super useful to a problem I am trying to tackle as well however I need to exclude the "blanks" in this column prior to the calculation. How would I edit the measure to achieve this?

PC2790
Community Champion
Community Champion

You can use COUNTROWS DAX function with an expression. Something like below:

 

%OnTimeStatus = DIVIDE(CALCULATE(COUNTROWS(FILTER(StatusTable,StatusColumn <> null)),StatusTable[Status] = "OnTime"),CALCULATE(COUNTROWS(StatusTable)))

 Used:

(COUNTROWS(FILTER(StatusTable,StatusColumn <> null))

Anonymous
Not applicable

I have given that a go however receive the error message "operator or expression 'NULL' is not supported in this context. I have included the measure I have used below.
 
"Psych Data" is my table name, and "Appointment Required" is my column in which I want to work out how many are "Yes".
 
Measure = DIVIDE(CALCULATE(COUNTROWS(FILTER('Psych data','Psych data'[Appointment required]<>null)),'Psych data'[Appointment required]="Yes"),CALCULATE(COUNTROWS('Psych data')))
PC2790
Community Champion
Community Champion

Try:

 

Measure = DIVIDE(CALCULATE(COUNTROWS(FILTER('Psych data','Psych data'[Appointment required]<> BLANK())),'Psych data'[Appointment required]="Yes"),CALCULATE(COUNTROWS('Psych data')))

Anonymous
Not applicable

That's resulted in the same figure unfortunately.

 

Thankfully though I have managed to sort it; with some help from a work colleague. I really appreciate you taking the time though.

Anonymous
Not applicable

Thanx PC2790

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.