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
Anonymous
Not applicable

Aggregate amount of days in column to groups

Hi,

 

I have a calculated column of days an event is going on. The list is anything between 0 to 200. I want to aggregate that to groups like 0-5 Days, 6-10 Days, 11-30 Days, 31-60 Days, 61-90 Days and Over 90 Days. So anything between 0 and 5 would get the group 0-5 Days, etc.  I want to use that to calculate how many events are taking longer than 0-5 Days for example:

 

Example of the visual I'l trying to create: https://ibb.co/XjKqLZp 

 

Thank you in advance, 

Frank

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

 

you can create a column.

day group = SWITCH(TRUE(),'Table (2)'[day]<=5,"0-5days",'Table (2)'[day]<=10,"6-10days",'Table (2)'[day]<=30,"11-30days",'Table (2)'[day]<=60,"31-60days",'Table (2)'[day]<=90,"61-90 days",">90days")

1.PNG

Then create a measure

count = COUNTX(FILTER('Table (2)','Table (2)'[day group]="0-5days"),'Table (2)'[day])

 2.PNG





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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@Anonymous 

 

you can create a column.

day group = SWITCH(TRUE(),'Table (2)'[day]<=5,"0-5days",'Table (2)'[day]<=10,"6-10days",'Table (2)'[day]<=30,"11-30days",'Table (2)'[day]<=60,"31-60days",'Table (2)'[day]<=90,"61-90 days",">90days")

1.PNG

Then create a measure

count = COUNTX(FILTER('Table (2)','Table (2)'[day group]="0-5days"),'Table (2)'[day])

 2.PNG





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

Proud to be a Super User!




Anonymous
Not applicable

This worked after I added a space between the condition and the value <=5 , "0-5 Days" ....

Anonymous
Not applicable

Thank you for the suggestion. I tried im getting this error: Unexpected expression '"0-5days"'. (I changed the table and column name to the correct)

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please share some screenshots or a dummy .pbix file, so we can help you find the cause of the problem. Please remove sensitive information.

 

 

Best Regards,

Icey

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.