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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BarathM
New Member

Need Help : Data Grouping by Duration and Process

Hi

    I need some help. I am newbie to Power Bi. I have data table as shown below.  I would like to add a new column to calculate the duration differents between "End Date" - "Start Date" in days.

 

1. Then I would like to group the the data by durations in day. This is for 1st scenario. For example,

< 0 day 

> 1 day and < 2 day

> 2 day and < 3 day

 

2. I also would like to do grouping like how many times  units when thru how many Process steps. This is the second scenario.

 

Unit IdStart DateEnd DateProcess
18/4/2020 23:598/5/2020 17:21BT
28/4/2020 13:498/4/2020 18:05BT
38/3/2020 21:248/4/2020 8:14BT
48/3/2020 16:138/4/2020 2:28BT
58/3/2020 12:278/4/2020 8:07BT
28/3/2020 10:198/3/2020 11:13Proscan
38/3/2020 7:458/4/2020 2:11Proscan
18/2/2020 19:498/3/2020 18:43Proscan
18/2/2020 9:188/3/2020 11:27FT
18/2/2020 9:058/3/2020 11:06BT
58/1/2020 14:108/3/2020 11:27Proscan

 

Thank you

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @BarathM 

1. 

create calculated columns

 

duration = DATEDIFF([Start Date],[End Date],DAY) 

groupbyduration =
SWITCH (
    TRUE (),
    [duration] <= 0, "<=0 day",
    [duration] >= 1
        && [duration] < 2, ">=1 and <2 day",
    [duration] >= 2
        && [duration] < 3, ">=2 and  day"
)

 

Capture5.JPG

 

2.

"do grouping like how many times  units when thru how many Process steps",

what does this mean?

does it group by units or process steps?

count time diff or different units?

 

If you need to count units grouped by process, create a measure like this

Measure = CALCULATE(COUNT('Table 3'[Unit Id]),ALLEXCEPT('Table 3','Table 3'[Process]))

Capture6.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

@BarathM - See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.