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

Categorize and label data based on a range

Hi,

I would like to categorize customers by their annual revenue using a definition in a separate table.
I assume it’s best done with a calculated column.

 

I use following formula now.

=IF(AllAccounts[Revenue of customer group]<10000;"Portfolio";
IF(AllAccounts[Revenue of customer group]<100000;"Account";
IF(AllAccounts[Revenue of customer group]<200000;"Strategic-";"Strategic+")))

 

I prefer to relate to a table with the definition as this allows for changing the definitions in a later stage in an easier way.

181723_01.png

I’ve found “Data categorization and labeling based on date range” but can’t apply that to what I want.

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

@Anonymous,

Create the AccountType column using DAX below in the AllAccounts table.

Account Type = CALCULATE(FIRSTNONBLANK(relatetable[Account type],relatetable[Account type]),FILTER(relatetable,relatetable[Lower cut-off]<=AllAccounts[Revenue of customer group]&&relatetable[Upper cut-off]>=AllAccounts[Revenue of customer group]))


1.JPG

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

Ashish_Mathur
Super User
Super User

Hi,

 

Write this calculated column formula in the Data Table

 

=CALCULATE(FIRSTNONBLANK(limits[Account Type],1),FILTER(limits,limits[Lower cut-off]<=EARLIER(Data[Revenue of Customer Group])&&limits[Upper cut-off]>=EARLIER(Data[Revenue of Customer Group])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Works! Now I need to find out why it works.

Many thanks, Lydia

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Thank you both for the solutions. This will help me furhter in understanding the matter.

/EJ

Ashish_Mathur
Super User
Super User

Hi,

 

Write this calculated column formula in the Data Table

 

=CALCULATE(FIRSTNONBLANK(limits[Account Type],1),FILTER(limits,limits[Lower cut-off]<=EARLIER(Data[Revenue of Customer Group])&&limits[Upper cut-off]>=EARLIER(Data[Revenue of Customer Group])))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This DAX formula worked for me. Ashish, could you explain the formula a bit further so that I can understand how the "EARLIER" functions work in this case? 

Thanks in advance. 

You are welcome.  The EARLIER() function can be understood as the value in the current row of the column specified in the EARLIER() function.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish_Mathur,

Works! Now I need to find out why it works.

Many thanks, Ashish!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@Anonymous,

Create the AccountType column using DAX below in the AllAccounts table.

Account Type = CALCULATE(FIRSTNONBLANK(relatetable[Account type],relatetable[Account type]),FILTER(relatetable,relatetable[Lower cut-off]<=AllAccounts[Revenue of customer group]&&relatetable[Upper cut-off]>=AllAccounts[Revenue of customer group]))


1.JPG

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

Works! Now I need to find out why it works.

Many thanks, Lydia

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.