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
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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


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.