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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
LRCSG
Frequent Visitor

DAX Calculation for column that contain text and number

Hello,

 

Does any one know how to calculate a column that has text and number for data?

 

I can calculate the results for the Column Overall Satisfaction using this DAX formula

Overall Satisfaction Score =
DIVIDE(CALCULATE(COUNT('Table1'[Overall Satisfaction]),
FILTER('Table1','Table1'[Overall Satisfaction]>=9)),
CALCULATE(COUNT('Table1'[Overall Satisfaction]),
FILTER('Table1','Table1'[Overall Satisfaction]>=1)))

 

but how would I write it for the Columns that have both text and number?

 

Survey IDOverall SatisfactionSpa SatisfactionPool Satisfaction
100000110910
10000029810
100000310Did not use10
10000049Did not use9
1000005682
10000068107
1000007989
1000008869
10000099Did not use9
1000010989
1000011879
1000012368
100001313Did not use
1000014594
10000158Did not use8
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below three measures, and the attached pbix file.

 

I think Overall Satisfaction Score measure also has to be written in a different way, like the below.

Please check if the below results are what you expected.

 

Overall Satisfaction Score = 
DIVIDE (
    CALCULATE (
        COUNT ( 'Table1'[Overall Satisfaction] ),
        FILTER ( 'Table1', 'Table1'[Overall Satisfaction] * 1 >= 9 )
    ),
    CALCULATE (
        COUNT ( 'Table1'[Overall Satisfaction] ),
        FILTER ( 'Table1', 'Table1'[Overall Satisfaction] * 1 >= 1 )
    )
)

 

Spa Satisfaction Score = 
DIVIDE (
    CALCULATE (
        COUNT ( 'Table1'[Spa Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Spa Satisfaction] * 1 >= 9
                && 'Table1'[Spa Satisfaction] <> "Did not use"
        )
    ),
    CALCULATE (
        COUNT ( 'Table1'[Spa Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Spa Satisfaction] * 1 >= 1
                && 'Table1'[Spa Satisfaction] <> "Did not use"
        )
    )
)

 

Pool Satisfaction Score = 
DIVIDE (
    CALCULATE (
        COUNT ( 'Table1'[Pool Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Pool Satisfaction] * 1 >= 9
                && 'Table1'[Pool Satisfaction] <> "Did not use"
        )
    ),
    CALCULATE (
        COUNT ( 'Table1'[Pool Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Pool Satisfaction] * 1 >= 1
                && 'Table1'[Pool Satisfaction] <> "Did not use"
        )
    )
)

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

2 REPLIES 2
LRCSG
Frequent Visitor

@Jihwan_Kim Wow. This is what I need and couldn't achieve. Thank you so much for your guidance and solution.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below three measures, and the attached pbix file.

 

I think Overall Satisfaction Score measure also has to be written in a different way, like the below.

Please check if the below results are what you expected.

 

Overall Satisfaction Score = 
DIVIDE (
    CALCULATE (
        COUNT ( 'Table1'[Overall Satisfaction] ),
        FILTER ( 'Table1', 'Table1'[Overall Satisfaction] * 1 >= 9 )
    ),
    CALCULATE (
        COUNT ( 'Table1'[Overall Satisfaction] ),
        FILTER ( 'Table1', 'Table1'[Overall Satisfaction] * 1 >= 1 )
    )
)

 

Spa Satisfaction Score = 
DIVIDE (
    CALCULATE (
        COUNT ( 'Table1'[Spa Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Spa Satisfaction] * 1 >= 9
                && 'Table1'[Spa Satisfaction] <> "Did not use"
        )
    ),
    CALCULATE (
        COUNT ( 'Table1'[Spa Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Spa Satisfaction] * 1 >= 1
                && 'Table1'[Spa Satisfaction] <> "Did not use"
        )
    )
)

 

Pool Satisfaction Score = 
DIVIDE (
    CALCULATE (
        COUNT ( 'Table1'[Pool Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Pool Satisfaction] * 1 >= 9
                && 'Table1'[Pool Satisfaction] <> "Did not use"
        )
    ),
    CALCULATE (
        COUNT ( 'Table1'[Pool Satisfaction] ),
        FILTER (
            'Table1',
            'Table1'[Pool Satisfaction] * 1 >= 1
                && 'Table1'[Pool Satisfaction] <> "Did not use"
        )
    )
)

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.