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
H1r0ka
Frequent Visitor

Rank colum

There are follwoing three tables. Customer table and Sales table are joined with cusomter ID and customer table has 'Sales Total' column.

I'd like to add a rank colum to Cusomter table

I've tried to use '= witch ( TRUE(),[Sales Total]=0,"Minor",[Sales Total]>100,"General",[Sales Total >500],"Big" )   

However all rank colum result shows "Minor".  How to add a rank colum to Customer table?

 

Customer table,

Customer NaneCustomer ID
A001
B002
C003

 

Sales table,

DateSalesCustomer ID
20-Aug100003
21-Aug200002
22-Aug50003
23-Aug500002
24-Aug300

001

 

Rank table

RankType
0>Minor
100>General
500>Big
2 ACCEPTED SOLUTIONS
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @H1r0ka,

 

You could create a calculated column with the formula below.

 

Column =
VAR sales_total =
    CALCULATE ( SUM ( Sales[Sales] ) )
RETURN
    IF (
        AND ( sales_total >= 0, sales_total < 100 ),
        "Minor",
        IF (
            AND ( sales_total > 100, sales_total < 500 ),
            "General",
            IF ( sales_total > 500, "Big" )
        )
    )

Then you could get the output like this.

 

Capture.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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

Hi Cherry,

 

Thank you very much for your solution.

すごいね!

Thank you again,

H1r0ka

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @H1r0ka,

 

You could create a calculated column with the formula below.

 

Column =
VAR sales_total =
    CALCULATE ( SUM ( Sales[Sales] ) )
RETURN
    IF (
        AND ( sales_total >= 0, sales_total < 100 ),
        "Minor",
        IF (
            AND ( sales_total > 100, sales_total < 500 ),
            "General",
            IF ( sales_total > 500, "Big" )
        )
    )

Then you could get the output like this.

 

Capture.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Cherry,

 

Thank you very much for your solution.

すごいね!

Thank you again,

H1r0ka

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.