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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Milagros
Helper I
Helper I

undefined

Hi, I am tryng to write an if function that will give the number of days between two dates, with some quaifications.

 

IF DateB is BLANK, then count the days from DateA to today's date

IF DateA is after (greater than) DateB, then show 0 (zero days)

ELSE Count the days between DateA and DateB

 

I have written this formula, and not have any luck so far...I am getting a "Too many arguments...." message.

 

Days Void to Contractor = if(ISBLANK('Source data'[Keys to Maintenance Contractor],DATEDIFF('Source data'[Void Date],TODAY(),DAY,IF('Source data'[Void Date]>'Source data'[Keys to Maintenance Contractor],0,DATEDIFF('Source data'[Void Date],'Source data'[Keys Returned from Contractor],DAY)))))
1 ACCEPTED SOLUTION
DataZoe
Microsoft Employee
Microsoft Employee

Hi @Milagros 

 

Try this:

Days Void to Contractor =
IF (
    ISBLANK ( 'Source data'[Keys to Maintenance Contractor] ),
    DATEDIFF ( 'Source data'[Void Date], TODAY (), DAY ),
    IF (
        'Source data'[Void Date] > 'Source data'[Keys to Maintenance Contractor],
        0,
        DATEDIFF (
            'Source data'[Void Date],
            'Source data'[Keys Returned from Contractor],
            DAY
        )
    )
)

 

I used DAX Studio to help figure out where the missing )'s were!

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

2 REPLIES 2
DataZoe
Microsoft Employee
Microsoft Employee

Hi @Milagros 

 

Try this:

Days Void to Contractor =
IF (
    ISBLANK ( 'Source data'[Keys to Maintenance Contractor] ),
    DATEDIFF ( 'Source data'[Void Date], TODAY (), DAY ),
    IF (
        'Source data'[Void Date] > 'Source data'[Keys to Maintenance Contractor],
        0,
        DATEDIFF (
            'Source data'[Void Date],
            'Source data'[Keys Returned from Contractor],
            DAY
        )
    )
)

 

I used DAX Studio to help figure out where the missing )'s were!

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Big thanks DataZoe....that works!  :):):)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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