Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

It keeps giving me this error

 

What data format should i choose? Thanks. 

 

Basically i wanna show n/m when the values > 100 but keeping the format as original. 

 

2 Replies

  • Daniel29195's avatar
    Daniel29195
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    the amount variable in some cases, is returing 'n/m' , whcih then you are comparing with a number ( = 100) . 

     

    in the return statement

    RETURN 

    switch(

    true () ,

    isnumber(_amount) , 

    if( abs(_amount) > 100 , "n/m", _amount ),

    _amount 

    )

     

     

    let me know if this helps .

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    According to the error message, it seems that the problem is caused by the data type mismatch. Please try the following methods and check if they can solve your problem:

    1.Please make sure the measure have the correct data type.

    2.ABS function returns the absolute value of a number. Verify the data and _amount variable result is correct.

    3.Try to use the format function.

    FORMAT function (DAX) - DAX | Microsoft Learn

    4.You can also view the following link to learn more about calculation error.

    Solved: MdxScript(Model) / Calulcation error in (...) - Microsoft Fabric Community

     

    If the above ones can’t help you get it working, could you please provide more raw data(exclude sensitive data) with Text format to make a deep troubleshooting? It would be helpful to find out the solution.

    You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

     

    Best Regards,

    Wisdom Wu

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