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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
spriyanshu
Frequent Visitor

Calculate Percentage of Non Numeric(text) Column

I have a Calculated Column, which represent invoice passed or failed against Invoice Numbers. This is a text cloumn with field value as "Success" or "Failure" which is a text datatype.
What i am trying to acheive is how many invoices submitted succesfully in the duration and Percentage of it.

Using simple date slicer to select duration. 

 

8 REPLIES 8
Anonymous
Not applicable

Hi @spriyanshu,

 

If the date column of the data table is used in the DAX expression of the status column, please consider creating a calendar table and a relationship with the data table. and use the date column from the calendar table instead of the data table date column in the expression and slicer.

vcgaomsft_0-1648692347976.png

Measure.

Success count = 
VAR _value = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Status]="Success"))
RETURN
IF(_value<>0,_value,0)
Success ratio = 
VAR _value = CALCULATE(COUNTROWS('Table'))
RETURN
DIVIDE([Success count],_value)

vcgaomsft_1-1648692851573.png

Attach the PBIX file for reference. Hope it helps.

 

If this doesn't work for you or I misunderstand your needs, please consider sharing more details about it. And it would be great if there was a sample file without any sensitive information here.

 

It makes it easier to give you a solution.

  1. Sample (dummy dataset) data as text, use the table tool in the editing bar.
  2. Expected output from sample data.
  3. Explanation in words of how to get from 1. to 2.

 

Here are some references that may be helpful.

How to Get Your Question Answered Quickly

How to provide sample data

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Thanks for the solution, but what i was looking for is when i change the date filter to yearly or monthy, it will calculate number of success in "SUPP Benchmark" field and gives it percentage in success against total number of success and failure in same field and show it in form of Card Visual

spriyanshu_0-1648702856617.png

 

Anonymous
Not applicable

Hi @spriyanshu ,

 

I'm still not sure what you want, I created a simple for testing.

vcgaomsft_3-1648708409512.png

Suppose the slicer's field content is April 2022.

vcgaomsft_1-1648708154836.png

vcgaomsft_2-1648708268542.png

vcgaomsft_4-1648708662387.png

Count the number of successes in the "SUPP Benchmark" field.

Success count = 
VAR _value = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Status]="Success"))
RETURN
IF(_value<>0,_value,0)

vcgaomsft_5-1648709222460.png

percentage in success against total number of success and failure in same field.

Ratio = 
VAR _value = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[SUPP Benchmark]="failure"))
RETURN
DIVIDE([Success count],_value)

Chang the format of the measure.

vcgaomsft_6-1648710187032.png

vcgaomsft_7-1648710241463.png

 

Attach the PBIX file for reference. Hope it helps.

 

If this doesn't work for you or I misunderstand your needs, please consider sharing more details about it. And it would be great if there was a sample file without any sensitive information here.

 

It makes it easier to give you a solution.

  1. Sample (dummy dataset) data as text, use the table tool in the editing bar.
  2. Expected output from sample data.
  3. Explanation in words of how to get from 1. to 2.

 

Here are some references that may be helpful.

How to Get Your Question Answered Quickly

How to provide sample data

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

spriyanshu_0-1648714138962.png

This is just the idea i am giving about the benchmark, the actual calcualtion again depend on different calculated columns

Dax for Benchmark: 

Benchmark = if ('Table'[Status] = "Success", "Success", "Benchmark Crossed")

 

SupplierDateStatus
A3/25/2021Success
B3/25/2021Failure
C3/25/2021Success
D3/25/2021Success
E8/25/2021Success
F8/25/2021Failure
G8/25/2021Success
H8/25/2021Failure
I8/25/2021Success
J8/25/2021Failure
K3/25/2021Success
L8/25/2021Success
M6/25/2021Failure
N6/25/2021Success
O6/25/2021Failure
P6/25/2021Success
Q11/25/2021Success
R6/25/2021Failure
S6/25/2021Success
T6/25/2021Success
U11/25/2021Failure
V6/25/2021Success
W11/25/2021Failure
X11/25/2021Success
Y11/25/2021Success
Z11/25/2021Failure
  
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

I hope you can get an idea from this sample file about how to create measures for your data model.

 

Picture1.png

 

Success count: = 
CALCULATE ( COUNTROWS ( Data ), Data[Status] = "Success" )

 

Success ratio: = 
DIVIDE ( [Success count:], COUNTROWS ( Data ) )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi Jihwan
I tried this already, but its throwing an error of "circular dependency"

In My data model only one fact table is there, Column which represent "Success" and "Failure" is a calculated column

Hi,

Share the download link of your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

If it is OK, please share your sample pbix file, and then I can try to come up with a more accurate solution.

Thank you.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors