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
AlessandroBet
Resolver I
Resolver I

Segmentation

Hi,

 

i have a table with 2 columns (Client name, Saleprice)

i need to add a new column "Segmentation" that it takes the parameter from Min and Max and put the value A, B, C and D from the table below

Screenshot 2023-12-01 162133.png

 

EX: of new table with new column

 

Client Name    Sales Price    Segmentation

AAAA               1200             B

BBBB                 500              A

CCCC                7500             D

 

Many thanks

1 ACCEPTED SOLUTION

Hi @AlessandroBet 

The previous code will work, because when you use >= , it will show you proper data 
or try below code, here I have mentioned both range. Please change range as per your requirement

= if [Sales Price] >= 5000 and <= 9999.9999 then "D" else if [Sales Price] >= 3000 and <= 4999.9999 then "C" else if [Sales Price] >= 1000 and <= 2999.9999 then "B" else "A"

 

If solved your requirement, please mark this answer as SOLUTION.
If this comment helps you, appreciate your KUDOS




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





View solution in original post

3 REPLIES 3
AlessandroBet
Resolver I
Resolver I

Thanks but i have to set 2 paramiters Min and Max and not only 1

Hi @AlessandroBet 

The previous code will work, because when you use >= , it will show you proper data 
or try below code, here I have mentioned both range. Please change range as per your requirement

= if [Sales Price] >= 5000 and <= 9999.9999 then "D" else if [Sales Price] >= 3000 and <= 4999.9999 then "C" else if [Sales Price] >= 1000 and <= 2999.9999 then "B" else "A"

 

If solved your requirement, please mark this answer as SOLUTION.
If this comment helps you, appreciate your KUDOS




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





PijushRoy
Super User
Super User

Hi @AlessandroBet 

If the Parameter table is fixed and parameter data are not changing 
Then you can create a custom column in your second table with name Segmentation in use the below code

= if [Sales Price] >= 5000 then "D" else if [Sales Price] >= 3000 then "C" else if [Sales Price] >= 1000 then "B" else "A"

 
Let me know if it solve your requirement




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





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.