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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Custom Bin Labels

I'm using Groups to cluster my data in bins. I'd like to label the bins by the intervals they represent. My bin size is 30, so I'd like my graphs to have labels like the following:

 

0-29

30-59

60-89

90-119

120-149

150-170

180-210

 

Instead my labels are 0, 30, 60, 90,120, 150, and 180.

 

Is there a way to customize those labels, or a better way to make my graphs that use bins more visually intuitive?

2 ACCEPTED SOLUTIONS
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@Anonymous,

There is no built-in option to customize the bin labels. In your scenario, you can add a column using the DAX below, then drag the column into your graph.

Column = IF(Table[columnname (bins)]=0,"0-30", if(Table[columnname (bins)]=30,"30-90",IF(Table[columnname (bins)]=90,"90-990",IF(Table[columnname (bins)]=990,"above 990",IF(Table[columnname (bins)]=120,"120-149", IF(Table[columnname (bins)]=150,"150-170", IF(Table[columnname (bins)],"180-210")))))))


Regards,
Lydia

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

bkrahulec
New Member

@Anonymous,

 

I would use SWITCH() function instead of nested IFs as follows:

 

NewBinName = SWITCH(
                         [YourBinName]=0,"0-29"
                         ,[YourBinName]=30,"30-59"
                         ...
                         ,[YourBinName]=180,"180-210"
                         ,"Unknown")

 

However, you don't need to cluster your variable by in-built functionality into category first, when you have to rename it anyway. You can create new column with the category using the SWITCH() function by yourself as follows:

 

NewCategory = SWITCH(
                         TRUE(),
                         [BaseVariableName]<30,"0-29"
                         ,[BaseVariableName]<60,"30-59"
                         ...
                         ,[BaseVariableName]<211,"180-210"
                         ,"")

 

The SWITCH() function prioritizes the conditions according to their order.

View solution in original post

3 REPLIES 3
bkrahulec
New Member

@Anonymous,

 

I would use SWITCH() function instead of nested IFs as follows:

 

NewBinName = SWITCH(
                         [YourBinName]=0,"0-29"
                         ,[YourBinName]=30,"30-59"
                         ...
                         ,[YourBinName]=180,"180-210"
                         ,"Unknown")

 

However, you don't need to cluster your variable by in-built functionality into category first, when you have to rename it anyway. You can create new column with the category using the SWITCH() function by yourself as follows:

 

NewCategory = SWITCH(
                         TRUE(),
                         [BaseVariableName]<30,"0-29"
                         ,[BaseVariableName]<60,"30-59"
                         ...
                         ,[BaseVariableName]<211,"180-210"
                         ,"")

 

The SWITCH() function prioritizes the conditions according to their order.

Hi, 

Do you know whether there is any way to do this and leave the bins unsorted, i.e. that they don't order by size? 
I am looking at data for when actions are performed relative to their due dates, and  want bins grouped as '1 day overdue', '2-4 days overdue', '5-7 days overdue' etc.

I haven't been able to sort these according to days in any sensible matter. Do you, or anyone else here know how/if I can do this? 🙂 


v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@Anonymous,

There is no built-in option to customize the bin labels. In your scenario, you can add a column using the DAX below, then drag the column into your graph.

Column = IF(Table[columnname (bins)]=0,"0-30", if(Table[columnname (bins)]=30,"30-90",IF(Table[columnname (bins)]=90,"90-990",IF(Table[columnname (bins)]=990,"above 990",IF(Table[columnname (bins)]=120,"120-149", IF(Table[columnname (bins)]=150,"150-170", IF(Table[columnname (bins)],"180-210")))))))


Regards,
Lydia

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.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.