Forum

Notifications
Clear all

How to Create A DAX Formula to Average Text Strings (No and Yes)

8 Posts
3 Users
0 Reactions
299 Views
(@tyronedames)
Posts: 21
Eminent Member
Topic starter
 

Hi,

I attempted to create a DAX Formula to get the average for "no" and "yes" string; however, I received an error.  This is the error:  The function average takes an argument that evaluates to numbers or data and cannot work with values of type String.  Our section supervisors review patients' records to ensure clerks have verified a patient's demographic by indicating "no" or "yes".  I want to great a measure to get the average of "no" and "yes".  I attach an example of the workbook.  Please provide insight how to resolve issue.

 
Posted : 23/09/2024 11:21 pm
Riny van Eekelen
(@riny)
Posts: 1194
Member Moderator
 

Please clarify which averages you expect to see if you were to calculate them manually.

 
Posted : 25/09/2024 3:18 am
(@tyronedames)
Posts: 21
Eminent Member
Topic starter
 

Sorry for the delay.  Both for "no" and "yes" replies.

 
Posted : 27/09/2024 3:12 pm
Riny van Eekelen
(@riny)
Posts: 1194
Member Moderator
 

What I meant is that you need to explain how you would calculate such an average.

 
Posted : 28/09/2024 12:56 am
(@tyronedames)
Posts: 21
Eminent Member
Topic starter
 

Riny, hi, I'm back.  It has been tasking to close out the fiscal year 2024 and start a new fiscal year  for 2025 (October 1).  My understanding Excel does not have a built-in function to calculate an average based on text (yes or no).  If a numerical value was assigned, yes=1 and no=2, would this be a solution?

 
Posted : 06/10/2024 2:00 am
Riny van Eekelen
(@riny)
Posts: 1194
Member Moderator
 

Maybe, but I still don't understand. If 'Yes' would become 1 and 'No'  would be 2, 3 yes and 2 no would average to (1+1+1+2+2) / 5 = 1.4. But does that mean?

Wouldn't you want to calculate the percentage number of Yes and No of the total number of indications? I've added some DAX measures that calculate such percentages. See attached. If this is not what you want, please explain what 'average' (in numbers) you expect to see in the pivot table.

 
Posted : 07/10/2024 3:03 am
(@keebellah)
Posts: 373
Reputable Member
 

Hi, excuse my butting in 🙂

I'm not that proficient in Pivot Tables or DAX functions, but I like to play with formula's next to VBA.

This is my formula idea,

 
Posted : 07/10/2024 4:12 am
(@tyronedames)
Posts: 21
Eminent Member
Topic starter
 

Hans, hi, thank you for taking time to review the issue and provide a solution.  This will work .

 
Posted : 09/10/2024 10:23 am
Share: