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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculate Stage based on Value

Hello All,

 

I have a total value as an output and I need to assign it a stage depending on Upper bound and Lower bound values for that stage.

Can someone help me with THE DAX as I am struggling to understand what is the write command to be written

 

My total=3 so it should print "M" 

 

StageLower bound Upper bound
N1.01.5
B1.52.5
M2.53.5
GP3.54.5
 Champion4.55.0
1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to assign [Stage] to the corresponding Total based on your rating table. Right?

Here are the steps you can follow:

(1)This is my test data :  Level and Score

vyueyunzhmsft_0-1662531344557.png

 

vyueyunzhmsft_1-1662531344560.png

 

(2)We can create a measure : Level_name

 

Level_name =
VAR _total =
    SUM ( 'Score'[score] )
VAR _level =
    MAXX (
        FILTER (
            'Level',
            'Level'[Lower bound] <= _total
                && _total <= 'Level'[Upper bound]
        ),
        [Stage]
    )
RETURN
    IF ( _level = BLANK (), "none level match", _level )

 

 

(3)Then we can put the measure in the visual and other fields we need , then we can meet your need :

vyueyunzhmsft_2-1662531344564.png

 

If this method can't meet your requirement, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

This is my test .pbix file : Level.pbix 

 

Best Regards,

Aniya 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

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, you want to assign [Stage] to the corresponding Total based on your rating table. Right?

Here are the steps you can follow:

(1)This is my test data :  Level and Score

vyueyunzhmsft_0-1662531344557.png

 

vyueyunzhmsft_1-1662531344560.png

 

(2)We can create a measure : Level_name

 

Level_name =
VAR _total =
    SUM ( 'Score'[score] )
VAR _level =
    MAXX (
        FILTER (
            'Level',
            'Level'[Lower bound] <= _total
                && _total <= 'Level'[Upper bound]
        ),
        [Stage]
    )
RETURN
    IF ( _level = BLANK (), "none level match", _level )

 

 

(3)Then we can put the measure in the visual and other fields we need , then we can meet your need :

vyueyunzhmsft_2-1662531344564.png

 

If this method can't meet your requirement, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

This is my test .pbix file : Level.pbix 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

tamerj1
Super User
Super User

Hi @Anonymous 

please try

Stage =
VAR TotalValue = [Total Value]
VAR T1 =
    FILTER (
        Stages,
        Stages[Lower bound] <= TotalValue
            && Stages[Upper bound] >= TotalValue
    )
RETURN
    MAXX ( T1, Stages[Stage] )

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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