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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Elisa112
Helper V
Helper V

Compare dates in a summarised table

Hi Experts

 

I have summarise data based on columns from a customer and a training outcome table, Im gtrying to find the number of days from the customer start date to the date they found a job.  My dax works well to summarise however I now am finding it difficult to compare the dates, the error is the date holders (start date, outcome date) cannot be found.  I have tried to use variables but still no luck, so wondering where I am going wrong.  Here is my DAX:

 

Time_to_employment =

SUMMARIZECOLUMNS(

    'Customer'[Customer ID], 'Customer'[Start Date],'Training_Outcome'[Contract Type],

    "Job Outcome",

CALCULATE(MAX('Training_Outcome'[Outcome Date]),

        FILTER( 'Training_Outcome',

            'Training_Outcome'[Customer ID] = SELECTEDVALUE('Training_Outcome'[Customer ID])

             && 'Training_Outcome'[Type] = "Employed"),

    "Start to employment", Networkdays(Start_Date, Outcome_Date)- 1                           

    ))

All help appreciated, thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Elisa112 

 

Is this the result you expected? If not, please provide more information.

Days to employment = DATEDIFF([Start Date],[Outcome Date],DAY)

vzhangtinmsft_0-1731549790390.png

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi, @Elisa112 

 

Have you solved your problem? If not, can you provide example data and your desired output?

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

 

Best Regards,

Community Support Team _Charlotte

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

Hello @Anonymous 

 

My summary table looks like this

 

Customer ID      Start Date        Outcome Date      OutcomeType

123                     15 Jan 2024     15 March 2024      Employed

 

I  looking for the following output:

 

Customer ID      Start Date        Outcome Date      OutcomeType    Days to employment

123                     15 Jan 2024     15 March 2024      Employed          90

 

I would rather the column days to employment is a calculated column rather than a measure

 

Thanks for your assistance

 

 

Anonymous
Not applicable

Hi, @Elisa112 

 

Is this the result you expected? If not, please provide more information.

Days to employment = DATEDIFF([Start Date],[Outcome Date],DAY)

vzhangtinmsft_0-1731549790390.png

 

Best Regards,

Community Support Team _Charlotte

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

Thank you

johnt75
Super User
Super User

You could create a measure like

Start to employment =
VAR CustomerID =
    SELECTEDVALUE ( 'Customer'[Customer ID] )
VAR StartDate =
    SELECTEDVALUE ( 'Customer'[Start Date] )
VAR EndDate =
    CALCULATE (
        MAX ( 'Training_Outcome'[Outcome Date] ),
        TREATAS (
            { ( CustomerID, "Employed" ) },
            'Training_Outcome'[Customer ID],
            'Training_Outcome'[Type]
        )
    )
VAR Result =
    NETWORKDAYS ( StartDate, EndDate ) - 1
RETURN
    Result

@johnt75 

thank you

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors