Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Solved! Go to Solution.
@Anonymous,
Based on your description, to achieve your requirement, you can create a calculate column using DAX below:
Task completion Days =
VAR previous_approval_date =
CALCULATE (
MAX ( Table1[Approval Date/time] ),
FILTER (
Table1,
Table1[Index]
= EARLIER ( Table1[Index] ) - 1
&& Table1[Requistion ID] = EARLIER ( Table1[Requistion ID] )
)
)
RETURN
SWITCH (
TRUE (),
Table1[Index] = 1, DATEDIFF ( Table1[Approval Date/time], Table1[Requisition Date], DAY ),
Table1[Index] > 1, DATEDIFF ( Table1[Approval Date/time], previous_approval_date, DAY )
)
You can also refer to the appendix.
Regards,
Jimmy Tao
@Anonymous,
You should create a calculate column, not a measure.
Regards,
Jimmy Tao
@Anonymous,
Based on your description, to achieve your requirement, you can create a calculate column using DAX below:
Task completion Days =
VAR previous_approval_date =
CALCULATE (
MAX ( Table1[Approval Date/time] ),
FILTER (
Table1,
Table1[Index]
= EARLIER ( Table1[Index] ) - 1
&& Table1[Requistion ID] = EARLIER ( Table1[Requistion ID] )
)
)
RETURN
SWITCH (
TRUE (),
Table1[Index] = 1, DATEDIFF ( Table1[Approval Date/time], Table1[Requisition Date], DAY ),
Table1[Index] > 1, DATEDIFF ( Table1[Approval Date/time], previous_approval_date, DAY )
)
You can also refer to the appendix.
Regards,
Jimmy Tao
Hello Jimmy,
Thanks for your expression . I also need to find the latest date based on Index ( i.e. Max(Index)) in Our case Index 4 is the highest index for requistion ID xyz123. I need to get the Latest Approval Date/Time( i.e. DEC 6,2018) AND SUBTRACT it with first requistion date ( Nov 15,2018) to get the number of days it took to complete the given task for a specified requistion ID . I will appreciate if you could help me getting the expression.
Thanks
@Anonymous,
You should create a calculate column, not a measure.
Regards,
Jimmy Tao
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.