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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Shree_185
Helper I
Helper I

SLA Range/Grouping Dax

Hi,

 

Can anyone help me here?

 

I have "Pending Days" field in D:hh:mm: ss format - ex- 1 day 00:30:00. I want to group them on 0-20 , 21 to 40, 41 to 60 days.......likewise 

 

Logic: if "Pending Days" come in 0-20 days then "0-20 group" likewise 

 

Ticket Nopending in daysGroups
123450 Day 00:19:000-20
4567823 Day 00:09:0021 -40
5467853 Day 00:19:0041 -60
678941 Day 00:19:0041-60
2 ACCEPTED SOLUTIONS
MFelix
Super User
Super User

Hi @Shree_185 ,

 

You can create a calculated column wiht the following syntax:

Days Group =
SWITCH (
    TRUE (),
    LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) <= "20", "0-20",
    LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) > "20"
        && LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) <= "40", "21-40",
    LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) > "40"
        && LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) <= "60", "41-60",
    ">60"
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

v-xiaotang
Community Support
Community Support

Hi @Shree_185 

If you want to create a measure, you can try this,

Measure = 
var _getDay= INT(LEFT(MIN('Table'[pending in days]),SEARCH("D",MIN('Table'[pending in days]),,BLANK())-2))
return SWITCH(TRUE(),
_getDay>=0 && _getDay<21,"0-20",
_getDay>=21 && _getDay<41,"21-40",
_getDay>=41 && _getDay<61,"41-60"
)

 

vxiaotang_0-1635909041040.png

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @Shree_185 

If you want to create a measure, you can try this,

Measure = 
var _getDay= INT(LEFT(MIN('Table'[pending in days]),SEARCH("D",MIN('Table'[pending in days]),,BLANK())-2))
return SWITCH(TRUE(),
_getDay>=0 && _getDay<21,"0-20",
_getDay>=21 && _getDay<41,"21-40",
_getDay>=41 && _getDay<61,"41-60"
)

 

vxiaotang_0-1635909041040.png

 

Best Regards,

Community Support Team _Tang

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

Thank you, you made my day!!!

MFelix
Super User
Super User

Hi @Shree_185 ,

 

You can create a calculated column wiht the following syntax:

Days Group =
SWITCH (
    TRUE (),
    LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) <= "20", "0-20",
    LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) > "20"
        && LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) <= "40", "21-40",
    LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) > "40"
        && LEFT ( 'Table'[pending in days], FIND ( "Day", 'Table'[pending in days] ) - 2 ) <= "60", "41-60",
    ">60"
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.