How to check whether the value is infinity, -infinity, or not a number using DAX formula?
- User
How to check whether the value is infinity, -infinity, or not a number using DAX formula?
- Assistant
In DAX, you can use the ISBLANK and ISINSCOPE functions to check whether a value is infinity, -infinity, or not a number.
Here's an example of how you can use these functions:
-
To check if a value is infinity, you can use the ISBLANK function along with the ISINSCOPE function. The ISINSCOPE function determines if the current expression is calculated within the context of a column or a table. Here's the formula:
codeIF(ISBLANK(value) && NOT(ISINSCOPE(value)), "Infinity", "Not Infinity")Replace
valuewith the column or measure you want to check for infinity. -
To check if a value is -infinity, you can use the same formula as above with a slight modification. Here's the formula:
codeIF(ISBLANK(value) && NOT(ISINSCOPE(value)) && value < 0, "-Infinity", "Not -Infinity")Replace
valuewith the column or measure you want to check for -infinity.
-
- User
how to type -infinity in dax power bi?
- Assistant
In DAX, to represent
-infinity(negative infinity), you can use the constantNEGATIVE_INFINITY, which is a special value available in DAX. Here's how you can type it:code-NEGATIVE_INFINITYYou can use this expression in any DAX formula where you need to compare values or perform calculations involving negative infinity.
- User
ROI(share, add%)_log = VAR SUM_GP = CALCULATE( SUM('Share16вед'[GP with share.byn]), ALLEXCEPT('Share16вед', 'Payers_clients'[Плательщик:#], 'Share16вед'[SCU Code], 'Share16вед'[Year], 'Share16вед'[Month])) VAR SUM_Log = CALCULATE( SUM('Share16вед'[Log with share.byn]), ALLEXCEPT('Share16вед', 'Payers_clients'[Плательщик:#], 'Share16вед'[SCU Code], 'Share16вед'[Year], 'Share16вед'[Month])) VAR SUM_Disc = CALCULATE( SUM('Share16вед'[Отгрузка по акции Discount, BYN]), ALLEXCEPT('Share16вед', 'Payers_clients'[Плательщик:#], 'Share16вед'[SCU Code], 'Share16вед'[Year], 'Share16вед'[Month]))
RETURN DIVIDE(SUM(SUM_GP) - SUM(SUM_Log), SUM(SUM_Disc))
Fix the error The SUM function only accepts a column reference as an argument.
- Assistant
To fix the error "The SUM function only accepts a column reference as an argument," you need to adjust your calculation inside the DIVIDE function. Instead of using nested SUM functions, directly reference the measures SUM_GP, SUM_Log, and SUM_Disc that you've calculated.
Here's the modified version of your formula with the fixed error:
code