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
gmooney100
Helper I
Helper I

IFERROR Error

I am getting an error "Argument '2' in IFERROR function is required.

 

 

% of Stores with void =
IF(
    HASONEVALUE(DTRData[Item]),
        IFERROR(DIVIDE(
            SUM('DTRData'[Void Count]),
                [Total Store Count],0),
        IFERROR(DIVIDE(
            SUM('DTRData'[Void Count]),
                AVERAGEX(DTRData,[All Items All Stores Selling]),0),
   
)))
 
Any thoughts for correcting?
5 REPLIES 5
grantsamborn
Solution Sage
Solution Sage

Hi @gmooney100 

The second argument isn't optional.

IFERROR - DAX Guide

 

@grantsamborn 

 

I know that but I am not sure what 2nd argument to list as I thought I had built the formula correctly.

Hi @gmooney100 

Because DIVIDE captures *almost* all possible errors, I'm wondering why you even need IFERROR (or ISERROR).

 

IF you need IFERROR for some reason, the following hopefully shows what you need.

 

% of Stores with void =
IF(
    HASONEVALUE( DTRData[Item] ),
    IFERROR(
        DIVIDE(
            SUM( 'DTRData'[Void Count] ),
            [Total Store Count],
            0
        ),
        ???     // Replace this with the expression you want calculated when the above expression would raise an error.
    ),
    IFERROR(
        DIVIDE(
            SUM( 'DTRData'[Void Count] ),
            AVERAGEX(
                DTRData,
                [All Items All Stores Selling]
            ),
            0
        ),
        ???     // Replace this with the expression you want calculated when the above expression would raise an error.
    )
)

 

 

If you want an example of ISERROR, let me know.

Grant

Are you sure you don't mean ISERROR?

ISERROR - DAX Guide

If the first argument would raise an error, it is replaced by the second argument.

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.