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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Calculate date difference for the projects which has tasks condition

Hi All,

Need help with calculating date difference for the projects which has only tasks "Enquiry Submitted" and "Approval Sent"

"Approval sent" should consider start date and "enquiry submitted "task should consider End date.
@amitchandak 

@Jihwan_Kim 
@dax 

 

ProjectTaskStart Dateend date
AC1Enquiry Submitted12-06-202209-06-2022
AC1Approval Sent19-06-202212-06-2022
AC2Enquiry Submitted05-06-202209-06-2022
AC3Enquiry Submitted04-06-202205-06-2022
AC4Enquiry Submitted1-06-202205-06-2022
AC4Approval Sent02-06-202201-07-2022
AC4Feedback submitted04-06-202209-06-2022
AC6Enquiry Submitted11-09-202221-06-2022
AC6Approval Sent21-06-202222-06-2022

 

Expected o/p:
Projects AC1 and AC6 to be considered
Ac1 date diff 19-06-2022 minus 09-06-2022 =10days
Ac6 date diff 21-06-2022 minus 21-06-2022 = 0day

1 ACCEPTED SOLUTION

Hi,

Thank you for your feedback.

Do you mean that the card visualization shows 5 as a result?

Please check the below meausre and the attached pbix file.

 

Expected avg measure: = 
AVERAGEX(VALUES(Data[Project]), [Date diff by condition measure:])

 

Untitled.png 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a measure.

 

Untitled.png

 

Date diff by condition measure: =
VAR _conditionone =
    COUNTROWS (
        FILTER ( Data, Data[Task] IN { "Enquiry Submitted", "Approval Sent" } )
    ) = 2
VAR _conditiontwo =
    COUNTROWS ( VALUES ( Data[Task] ) ) = 2
RETURN
    DATEDIFF (
        CALCULATE ( MAX ( Data[end date] ), Data[Task] = "Enquiry Submitted" ),
        CALCULATE ( MAX ( Data[Start Date] ), Data[Task] = "Approval Sent" ),
        DAY
    )
        * DIVIDE ( _conditionone, _conditiontwo )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi @Jihwan_Kim ,

 

Thank you for the response.It is working when I drag the project and "date diff by condition measure" into a table.

Is there a way to show the average of all these datediffs in a single card.

 

Thanks

Hi,

Thank you for your feedback.

Do you mean that the card visualization shows 5 as a result?

Please check the below meausre and the attached pbix file.

 

Expected avg measure: = 
AVERAGEX(VALUES(Data[Project]), [Date diff by condition measure:])

 

Untitled.png 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.