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
Bu__
Frequent Visitor

To group a numeric column containing the difference between 2 dates into same_day, day+1, >1 day

i want to convert a numeric column containing difference between 2 dates like (0,1,2,3..... so on) into 3 groups --> same_day, d+1 and >1 day

How to convert the numeric column and categorize them into 3 groups?

 

days between (difference b/w 2 dates)|  ---> | 3 categories

0                                                                            same day

1                                                                            D+1 day

2                                                                             >1 day

3                                                                             >1 day

....

6                                                                             >1 day

 

 

2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @Bu__ 

please try
=
SWITCH (

[days between],
0, "same day",

1, "D + 1 day",

"> 1 day"

)

View solution in original post

FreemanZ
Super User
Super User

hi @Bu__ 

try like:

categories =
SWITCH(
    TRUE(),
    [days between]=0, "same_day",
    [days between]=1, "d+1", 
    ">1 day"
)

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @Bu__ 

try like:

categories =
SWITCH(
    TRUE(),
    [days between]=0, "same_day",
    [days between]=1, "d+1", 
    ">1 day"
)
tamerj1
Super User
Super User

Hi @Bu__ 

please try
=
SWITCH (

[days between],
0, "same day",

1, "D + 1 day",

"> 1 day"

)

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.

Top Solution Authors