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! Request now

Reply
Wendy100
Frequent Visitor

Custom Cycle Time

Hi,

I have data like this:

Wendy100_0-1699427886290.png

 

what I would like to achieve: 

Wendy100_1-1699427936692.png

user can select the start time and end time as they like , and the matrix gives the avg cycle time with carrier to vpc drill down.

I know it is crazy but that where I am . Is it possible?
Much apprciated.

1 ACCEPTED SOLUTION
Wendy100
Frequent Visitor

I found a solution with selectedvalue function. share it here in case someone may need.

 

~Custom Cycle Time (hr) =
var date1=SELECTEDVALUE('~Stage Name_Start'[Stage Name_Start])
var date2=SELECTEDVALUE('~Stage Name_End'[Stage Name_End])

return
SWITCH(TRUE(),
date1="1. Create Date" && date2="2. Pick Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[create date],'~Order for KPI'[Pick Date],HOUR)),
date1="1. Create Date" && date2="3. Ship Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[create date],'~Order for KPI'[Ship Date],HOUR)),
date1="1. Create Date" && date2="4. Delivery Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[create date],'~Order for KPI'[~Deliver Date],HOUR)),

date1="2. Pick Date" && date2="3. Ship Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[Pick Date],'~Order for KPI'[Ship Date],HOUR)),
date1="2. Pick Date" && date2="4. Delivery Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[Pick Date],'~Order for KPI'[~Deliver Date],HOUR)),

date1="3. Ship Date" && date2="4. Delivery Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[Ship Date],'~Order for KPI'[~Deliver Date],HOUR)),

"Please Select Valid Stage")
Wendy100_1-1699596977606.png

 

View solution in original post

3 REPLIES 3
Wendy100
Frequent Visitor

I found a solution with selectedvalue function. share it here in case someone may need.

 

~Custom Cycle Time (hr) =
var date1=SELECTEDVALUE('~Stage Name_Start'[Stage Name_Start])
var date2=SELECTEDVALUE('~Stage Name_End'[Stage Name_End])

return
SWITCH(TRUE(),
date1="1. Create Date" && date2="2. Pick Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[create date],'~Order for KPI'[Pick Date],HOUR)),
date1="1. Create Date" && date2="3. Ship Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[create date],'~Order for KPI'[Ship Date],HOUR)),
date1="1. Create Date" && date2="4. Delivery Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[create date],'~Order for KPI'[~Deliver Date],HOUR)),

date1="2. Pick Date" && date2="3. Ship Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[Pick Date],'~Order for KPI'[Ship Date],HOUR)),
date1="2. Pick Date" && date2="4. Delivery Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[Pick Date],'~Order for KPI'[~Deliver Date],HOUR)),

date1="3. Ship Date" && date2="4. Delivery Date",AVERAGEX('~Order for KPI',DATEDIFF('~Order for KPI'[Ship Date],'~Order for KPI'[~Deliver Date],HOUR)),

"Please Select Valid Stage")
Wendy100_1-1699596977606.png

 

Anonymous
Not applicable

Hi  @Wendy100 

You can consider to use field paramater, you can refer to the following sample.

Sample data 

vxinruzhumsft_0-1699582839271.png

1.Create two paramater tables

Paramater 1

vxinruzhumsft_1-1699582894609.png

Paramater 2 is the sama as paramater 1

2.Create a measure

Measure =
VAR _start =
    SWITCH (
        MAX ( Parameter[Parameter Order] ),
        0, MAX ( 'Table'[Deliver Date] ),
        1, MAX ( 'Table'[Order Date] ),
        2, MAX ( 'Table'[Pick Date] ),
        3, MAX ( 'Table'[Ship Date] )
    )
VAR _end =
    SWITCH (
        MAX ( 'Parameter 2'[Parameter Order] ),
        0, MAX ( 'Table'[Deliver Date] ),
        1, MAX ( 'Table'[Order Date] ),
        2, MAX ( 'Table'[Pick Date] ),
        3, MAX ( 'Table'[Ship Date] )
    )
RETURN
    DATEDIFF ( _start, _end, MINUTE )

Output

vxinruzhumsft_2-1699582969074.png

 

You can refer to the following link to know more about field paramater

https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters#create-a-field-p...

 

Best Regards!

Yolo Zhu

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

thank you very much for your reply @Anonymous , but I am afraid there is gap to what I need. I down load the your shared file and change b to a, what I need is the avg instead of max.

Wendy100_0-1699596712954.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors