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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Blaired79
New Member

Wrong value returned

I am using this Dax statement in a columnto return a text value based on a decimal but it always returns the false value of nothing.  Where have I gone wrong?

 

 

 

Rating2 = SWITCH( TRUE(), [Total Score] < 6, "No change", [Total Score] >= 6 && [Total Score] < 10, "Low", [Total Score] >= 11 && [Total Score] < 15, "Medium", [Total Score] >= 16 && [Total Score] < 20, "Low", "" )

1 ACCEPTED SOLUTION
Blaired79
New Member

I found the issue, the measure and column will only work on whole numbers not decimals.

View solution in original post

3 REPLIES 3
Blaired79
New Member

I found the issue, the measure and column will only work on whole numbers not decimals.

Anonymous
Not applicable

Hi @Blaired79 

 

For your question, here is the approach I provide:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1708584998995.png

 

If you are creating a calculated column, your code will work.

 

 

Column Rating2 = 
    SWITCH(
        TRUE(), 
        [Total Score] < 6, "No change", 
        [Total Score] >= 6 && [Total Score] < 10, "Low", 
        [Total Score] >= 11 && [Total Score] < 15, "Medium", 
        [Total Score] >= 16 && [Total Score] < 20, "Low", 
        ""
    )

 

 

vnuocmsft_1-1708585137522.png

 

So I'm assuming if you create a measure.

 

Create a measure. Try the following code:

 

 

Measure Rating2 = var _score =  SELECTEDVALUE('Table'[Total Score])
RETURN  SWITCH(
        TRUE(), 
        _score < 6, "No change",
        _score >= 6 && _score < 10, "Low", 
        _score >= 11 && _score < 15, "Medium", 
        _score >= 16 && _score < 20, "Low", 
        " "
    )

 

 

Here is the result.

 

vnuocmsft_2-1708585313713.png

 

If you still have problems, it is best to provide the pbix file and be careful to delete sensitive data.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

sukhmanKaur
Regular Visitor

The DAX statement is working perfectly fine. I have attached the sample below.

sukhmanKaur_0-1708548320141.png

 

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.