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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Want measures to exclude calculation when date doesn't exist.

Completed hold stage for the top three rows hasn't got a completion date populated yet and it's defaulted to 44798.00

All the rows under this dont have a completion date for complaint actionable and it's doing the same thing. 

 

I want the DAX to give today's date if there is no completion date populated but only if the action EXISTS. I'm trying to get this to show the amount of time for each measure in days. 

 

Here are the two measures:

Completed Holding stage age =
VAR startdate = MAXX(FILTER('hgmcntac', hgmcntac[action_cd] = "C1001A"), hgmcntac[completed_dt])
VAR enddate = MAXX(FILTER('hgmcntac', hgmcntac[action_cd] = "C1002"), hgmcntac[completed_dt])
RETURN
ROUNDUP((enddate - startdate) * 1,0)
 
Complaint actionable =
VAR enddate = MAXX(FILTER('hgmcntac', hgmcntac[action_cd] = "C1001A"), hgmcntac[completed_dt])
VAR startdate = MAX(hgmcntct[taken_by_dt])
RETURN
ROUNDUP((enddate - startdate) * 1,0)

 

Dan492813_0-1661854602979.png

Thanks in advance, Dan

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

Completed Holding stage age =
VAR startdate =
    MAXX (
        FILTER ( 'hgmcntac', hgmcntac[action_cd] = "C1001A" ),
        hgmcntac[completed_dt]
    )
VAR enddate =
    MAXX (
        FILTER ( 'hgmcntac', hgmcntac[action_cd] = "C1002" ),
        COALESCE ( hgmcntac[completed_dt], TODAY () )
    )
RETURN
    ROUNDUP ( ( enddate - startdate ) * 1, 0 )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

Completed Holding stage age =
VAR startdate =
    MAXX (
        FILTER ( 'hgmcntac', hgmcntac[action_cd] = "C1001A" ),
        hgmcntac[completed_dt]
    )
VAR enddate =
    MAXX (
        FILTER ( 'hgmcntac', hgmcntac[action_cd] = "C1002" ),
        COALESCE ( hgmcntac[completed_dt], TODAY () )
    )
RETURN
    ROUNDUP ( ( enddate - startdate ) * 1, 0 )
Anonymous
Not applicable

You're a star. As always.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.