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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
MCornish
Responsive Resident
Responsive Resident

DAX Convert Text to Number

Hi

 

I have a table with responses to a questionaire. In the answers column there will be a mix of text and number e.g.

 

Q: Enter some text    |   This is text

Q: Enter a number    |    8

 

What I need is a measure that does an average of the question "Q: Enter a number"

 

What I have so far is:

 

VAR Numbers = SUMMARIZECOLUMNS( Responses[Reponder], Responses[Answer], FILTER( Responses, Responses[Question] = "Q: Enter a number"), "numAnsw", SUM(Responses[Answer]))

RETURN
AVERAGEX( Numbers, [numAnsw] + 0)
 
Its been through a few iterations trying to get it to work which is why its a bit weird, but in every case I end up with  "Function cannot work with values of type string"
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @MCornish 

try a measure

Measure = calculate(
    averagex(
        FILTER(ALL(Table2);
            NOT(ISERROR(VALUE(Table2[Answer])))
        );
    VALUE(Table2[Answer])))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

1 REPLY 1
az38
Community Champion
Community Champion

Hi @MCornish 

try a measure

Measure = calculate(
    averagex(
        FILTER(ALL(Table2);
            NOT(ISERROR(VALUE(Table2[Answer])))
        );
    VALUE(Table2[Answer])))

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.