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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Categorising and labeling based on whats above and bellow values

Hello

 

I need so help

I am trying to give certain supplyers a label based on sale value. 

In this example i whant the once with value bellow 10 to have C, above 10 to have B and above 20 to have A like shown in the second example. i need this to show in a matrix nad it is based on hundres of thousands of rows so i think i needs to be made in a measure using sum?

ex 1.pngex 2.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,


You can use below measure to get the summary category:

Category(Measure) =
VAR current_supplier =
    LASTNONBLANK ( 'Table'[Supplier], [Supplier] )
VAR last_date =
    LASTDATE ( ALLSELECTED('Table'[Date] ))
VAR total_amount =
    SUMX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            [Supplier] = current_supplier
                && [Date]
                    >= DATE ( YEAR ( last_date ), MONTH ( last_date ) - 12, DAY ( last_date ) )
        ),
        [Amount]
    )
RETURN
    IF ( total_amount < 1000000, "C", IF ( total_amount < 2000000, "B", "A" ) )

How to use: Create table visual with 'supplier', 'amount' and above measure, switch 'amount' column's summary mode to 'sum'.

 

Regards,

Xiaoxin Sheng

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous,

 

You can use belwo formula(calculate column) to get the result category:

Category =
IF ( [Amount] < 10, "C", IF ( [Amount] < 20, "B", "A" ) )

13.PNG

 

If you only want to use measure, you can try to use below measure version.

Category(Measure) =
VAR current_Amount =
    SELECTEDVALUE ( Test2[Amount] )
RETURN
    IF ( current_Amount < 10, "C", IF ( current_Amount < 20, "B", "A" ) )

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hi @Anonymous

Thank you for youre anwere

 

Is see now that i dide not post a valid example. I dide forget to show that the supplyers do show up multiple times, and i need the total sum of the supplyer to be the value to work with.

Is it possible to make the measure somthing along the lines of:

 

Category(Measure) =
VAR current_Amount =
SELECTEDVALUE ( test2[amount] )
RETURN
IF(SUM(test2[amount] < 1000000; "C";  IF(SUM(test2[amount] < 2000000; "B"; "A" ))))

and take into account only the last 12 months?

Anonymous
Not applicable

Hi @Anonymous,


You can use below measure to get the summary category:

Category(Measure) =
VAR current_supplier =
    LASTNONBLANK ( 'Table'[Supplier], [Supplier] )
VAR last_date =
    LASTDATE ( ALLSELECTED('Table'[Date] ))
VAR total_amount =
    SUMX (
        FILTER (
            ALLSELECTED ( 'Table' ),
            [Supplier] = current_supplier
                && [Date]
                    >= DATE ( YEAR ( last_date ), MONTH ( last_date ) - 12, DAY ( last_date ) )
        ),
        [Amount]
    )
RETURN
    IF ( total_amount < 1000000, "C", IF ( total_amount < 2000000, "B", "A" ) )

How to use: Create table visual with 'supplier', 'amount' and above measure, switch 'amount' column's summary mode to 'sum'.

 

Regards,

Xiaoxin Sheng

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors