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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Days Group DAX Function

Hi, Can you please help me with DAX formulas, I kinda stuck. 

 

I have START Date and END Date and need to calculate Days Between, I used this function below to create new column:

Days = DATEDIFF([START_DATE],[END_DATE],DAY)
Then I need to group them into categories, this is what I Use to create a new column:
Days Group = if([Days] = 0, "0 Day" , if([Days] = 1, "1 Day", if([Days]  = 2, "2 Days", if([Days] = 3, "3 Days", if([Days] = 4, "4 Days", if([Days] = 5, "5 Days", if([Days] >= 6, "6+ Days", IF(ISBLANK([Days]),BLANK(), "Pending" ))))))))
The problem is, that all my Blank Values capchuring under 0 Days Categorie, insted of Pendings. 
What should I fix in order to get me blanks under "Pendings"?
Also, my new column days is a number type, but if I change it to text then "pending" is working, but my other groups are getting messy. 
 
Please advice. 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

Please try to create one calculated column as below:

Days Group = IF ( ISBLANK ( [Days] ), "Pending", IF ( [Days] >= 6, "6+", [Days] ) & " Days" )

datediff.JPG

If the above formula is not applicable in your scenario, could you please explain which condition can be grouped as " Pending "?

 

Best Regards

Rena

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you, everyone, for the help!

Anonymous
Not applicable

Hi @Anonymous,

Please try to create one calculated column as below:

Days Group = IF ( ISBLANK ( [Days] ), "Pending", IF ( [Days] >= 6, "6+", [Days] ) & " Days" )

datediff.JPG

If the above formula is not applicable in your scenario, could you please explain which condition can be grouped as " Pending "?

 

Best Regards

Rena

az38
Community Champion
Community Champion

Hi @Anonymous 

try to use grouping technique as described here https://docs.microsoft.com/en-us/power-bi/desktop-grouping-and-binning


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
vivran22
Community Champion
Community Champion

Hello @Anonymous 

 

I would recommend to use Power Query for this:

 

Add a custom column:

1.PNG

 

Change the column type to number:

2.png

 

Add a conditional column:

3.PNG

 

Result:

4.PNG

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.