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
sanjeev803
Helper I
Helper I

How to create time slots in Power BI data set ?

 Hi All,

My data looks like this in excel:

Networkdays                 CYCLE TIMES
3                                    0-3 days
1                                    0-3 days
51                                 31+ days
4                                   4-7 days
4                                  4-7 days
14                                8-14 days

For "Cycle Time" there is a formula in this column that is
=IF(A2<=3,"0-3 days",IF(A2<=7,"4-7 days",IF(A2<=14,"8-14 days",IF(A2<=30,"15-30 days","31+ days"))))

I want to do same in Power BI Desktop.
Please assist how we can build a column like Cycle Time in Power BI dataset.

Thank you.

3 ACCEPTED SOLUTIONS
v-yuezhe-msft
Employee
Employee

Hi @sanjeev803

Right click your table in Power BI Desktop, select “New column”, paste the following formula. Then create a table visual, for more details, see the example in the screenshots below.

CYCLE TIMES = IF(Table[Networkdays]<=3, "0-3 days",IF(Table[Networkdays]<=7,"4-7 days",IF(Table[Networkdays]<=14,"8-14 days",IF(Table[Networkdays]<=30, "15-30 days","31+ days"))))

1.PNG2.PNG


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
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

... and if you want to avoid all those nested IF statements you can use the SWITCH statement:

 

SWITCH(TRUE(),

              NetworkDays <= 3, "0-3 days",

              NetworkDays <=10, "3-10 days",

              "10+ days")

 

Cheers,

 

Christian

 

View solution in original post

sanjeev803
Helper I
Helper I

Thank you. Its working perfectly fine. 🙂 

View solution in original post

4 REPLIES 4
sanjeev803
Helper I
Helper I

Thank you. Its working perfectly fine. 🙂 

v-yuezhe-msft
Employee
Employee

Hi @sanjeev803

Right click your table in Power BI Desktop, select “New column”, paste the following formula. Then create a table visual, for more details, see the example in the screenshots below.

CYCLE TIMES = IF(Table[Networkdays]<=3, "0-3 days",IF(Table[Networkdays]<=7,"4-7 days",IF(Table[Networkdays]<=14,"8-14 days",IF(Table[Networkdays]<=30, "15-30 days","31+ days"))))

1.PNG2.PNG


Thanks,
Lydia Zhang

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

... and if you want to avoid all those nested IF statements you can use the SWITCH statement:

 

SWITCH(TRUE(),

              NetworkDays <= 3, "0-3 days",

              NetworkDays <=10, "3-10 days",

              "10+ days")

 

Cheers,

 

Christian

 

sanjeev803
Helper I
Helper I

Hi All,

My data looks like this in excel:

Networkdays        CYCLE TIMES
3                           0-3 days
1                           0-3 days
51                        31+ days
4                          4-7 days
4                         4-7 days
14                       8-14 days

For "Cycle Time" there is a formula in this column that is
=IF(A2<=3,"0-3 days",IF(A2<=7,"4-7 days",IF(A2<=14,"8-14 days",IF(A2<=30,"15-30 days","31+ days"))))

I want to do same in Power BI Desktop.
Please assist how we can build a column like Cycle Time in Power BI dataset.

Thank you.

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.