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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
toddgack
New Member

Percentage based off of text value

Hey All,

 

I'm very new to Power BI and excel in general. The last two weeks I've gotten a fairly decent handle on some of the easier aspects of Desktop Power BI.

 

My boss has asked me to add in a chart to a Dashboard of his that shows the percentage of sales made from a prepaid credit card by sales rep.

 

Seems easy enough... Prepaid / Total Sales 

Axis = Rep Name

Value = Prepaid %

 

The propblem is that my data colums are all text based and I can't figure out how to get this to work.

 

I have two colums to base my data off of;

Prepaid 

Status

My Table is "Append 1" 

 

I need to find the percent of Prepaid "Yes" / Status "Completed"

 

The best that I've been able to formulate is this Measure

 

 PrePaid % = ((COUNTROWS(FILTER(Append1,Append1[Prepaid] = "Yes")))/(COUNTROWS(FILTER(Append1,Append1[Status] = "Completed"))))*100

 

This is returning every sales rep as having 100% prepaid usage.

 

Can anybody help me figure this out?

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @toddgack,

 

>>The problem is that my data columns are all text based and I can't figure out how to get this to work.
You can use value function to convert the text value to number.

According to your description, you can refer to below formula to get the “Prepaid %”:

Table:
Capture.PNG 

 

Measures:

 

Prepaid % =
var currAmount= if(AND(LASTNONBLANK(Sheet2[Prepaid],Sheet2[Prepaid])="Yes",LASTNONBLANK(Sheet2[Status],Sheet2[Status])="Completed"),VALUE(LASTNONBLANK(Sheet2[Amount],Sheet2[Amount])),0)
return
currAmount/SUMX(FILTER(ALL(Sheet2),Sheet2[Status]="Completed"),VALUE(Sheet2[Amount]))*100

 

Total Prepaid % = SUMX(FILTER(ALL(Sheet2),AND(Sheet2[Prepaid]="Yes",Sheet2[Status]="Completed")),VALUE(Sheet2[Amount]))/SUMX(FILTER(ALL(Sheet2),Sheet2[Status]="Completed"),VALUE(Sheet2[Amount]))*100

 

Stacked column chart visual:
Capture2.PNG 

 

Card:
 Capture3.PNG


Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @toddgack,

 

>>The problem is that my data columns are all text based and I can't figure out how to get this to work.
You can use value function to convert the text value to number.

According to your description, you can refer to below formula to get the “Prepaid %”:

Table:
Capture.PNG 

 

Measures:

 

Prepaid % =
var currAmount= if(AND(LASTNONBLANK(Sheet2[Prepaid],Sheet2[Prepaid])="Yes",LASTNONBLANK(Sheet2[Status],Sheet2[Status])="Completed"),VALUE(LASTNONBLANK(Sheet2[Amount],Sheet2[Amount])),0)
return
currAmount/SUMX(FILTER(ALL(Sheet2),Sheet2[Status]="Completed"),VALUE(Sheet2[Amount]))*100

 

Total Prepaid % = SUMX(FILTER(ALL(Sheet2),AND(Sheet2[Prepaid]="Yes",Sheet2[Status]="Completed")),VALUE(Sheet2[Amount]))/SUMX(FILTER(ALL(Sheet2),Sheet2[Status]="Completed"),VALUE(Sheet2[Amount]))*100

 

Stacked column chart visual:
Capture2.PNG 

 

Card:
 Capture3.PNG


Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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