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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gadielsolis
Super User
Super User

Segregating information using criteria for a single month

Hello community.

 

I'm attempting to categorize some groups based on quartiles. I have four quartiles (Top, Mid, Mid Bottom, Bottom), and the quartile is calculated using a measure like this: (Quartile= IF(Score>0.9,"Top",IF(Score>0.8,"Mid",IF(Score>0.7,"Mid Bottom",IF(Score<0.7,"Bottom")))).

 

I have a slicer that allows me to segregate the quartiles for a specific timeframe.

My issue is as follows: I need to show the performance of the group that ended in quartile one during the month of September (for example) in November and December. If I filter the three months, the visual will show only the advocates whose scores for the three months belong to the top quartile. How can I exhibit the performance for the following months for groups that belong to a quartile in a specific month?

 

Thank you in advance for the support.

 

1 ACCEPTED SOLUTION

 Hi @gadielsolis 

 

First, I've added a calculated column to your table

 

 

Quartile1 = IF('Sheet1'[Score]>0.9,"Top",IF('Sheet1'[Score]>0.8,"Mid",IF('Sheet1'[Score]>0.7,"Mid Bottom",IF('Sheet1'[Score]<=0.7,"Bottom"))))

 

 

 

vjialongymsft_0-1703747792070.png

 

You can then create a new slicer and drag the month into the slicer

 

vjialongymsft_1-1703747804269.png

 

You can use the dax below to get the employee's score for the next month

 

Next Month Performance = 
VAR CurrentMonth = MONTH ( SELECTEDVALUE( 'Sheet1'[Month] ) )
VAR Next_Month = CurrentMonth + 1
VAR CurrentName = SELECTEDVALUE ( 'Sheet1'[Name] )
RETURN
CALCULATE (
    SUM ( 'Sheet1'[Score] ), 
    FILTER (
        ALL('Sheet1'),
        MONTH ( 'Sheet1'[Month] ) = Next_Month &&
        'Sheet1'[Name] = CurrentName
    )
)

 

vjialongymsft_2-1703747823941.png

 

 

You can use the dax below to get the employee's quartile for the next month

 

Next Month Quartile = 
VAR CurrentMonth = MONTH ( SELECTEDVALUE( 'Sheet1'[Month] ) )
VAR Next_Month = CurrentMonth + 1
VAR CurrentName = SELECTEDVALUE ( 'Sheet1'[Name] )
RETURN
CALCULATE (
    MAX ( 'Sheet1'[Quartile1] ), 
    FILTER (
        ALL('Sheet1'),
        MONTH ( 'Sheet1'[Month] ) = Next_Month &&
        'Sheet1'[Name] = CurrentName
    )
)

 

 

 

 

 

vjialongymsft_3-1703747837905.png

 

If you want a score for the last two or three months, you can use a similar approach

 

Here’s the result you want

 

vjialongymsft_4-1703747849730.png

Best Regards,

Jayleny

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

6 REPLIES 6
gadielsolis
Super User
Super User

Hello, 

 

I've created an example to provide you more details.

 

gadielsolis_0-1703692787491.png

The table on the left is the score for that month and the table on the right is the quaritile based on that score.

 

What I would like to do is have the capacity to filter the names that ended in a specific quartile for a specific month (Let's say Tops for September) and show the performance for that specific group in the following months.

 

Sharing with you the file https://drive.google.com/file/d/15XQN4v0aYNeh8R98d-MMK0X_XnYfwIE1/view?usp=sharing.

 

Thank you in advance for the support.

 

 Hi @gadielsolis 

 

First, I've added a calculated column to your table

 

 

Quartile1 = IF('Sheet1'[Score]>0.9,"Top",IF('Sheet1'[Score]>0.8,"Mid",IF('Sheet1'[Score]>0.7,"Mid Bottom",IF('Sheet1'[Score]<=0.7,"Bottom"))))

 

 

 

vjialongymsft_0-1703747792070.png

 

You can then create a new slicer and drag the month into the slicer

 

vjialongymsft_1-1703747804269.png

 

You can use the dax below to get the employee's score for the next month

 

Next Month Performance = 
VAR CurrentMonth = MONTH ( SELECTEDVALUE( 'Sheet1'[Month] ) )
VAR Next_Month = CurrentMonth + 1
VAR CurrentName = SELECTEDVALUE ( 'Sheet1'[Name] )
RETURN
CALCULATE (
    SUM ( 'Sheet1'[Score] ), 
    FILTER (
        ALL('Sheet1'),
        MONTH ( 'Sheet1'[Month] ) = Next_Month &&
        'Sheet1'[Name] = CurrentName
    )
)

 

vjialongymsft_2-1703747823941.png

 

 

You can use the dax below to get the employee's quartile for the next month

 

Next Month Quartile = 
VAR CurrentMonth = MONTH ( SELECTEDVALUE( 'Sheet1'[Month] ) )
VAR Next_Month = CurrentMonth + 1
VAR CurrentName = SELECTEDVALUE ( 'Sheet1'[Name] )
RETURN
CALCULATE (
    MAX ( 'Sheet1'[Quartile1] ), 
    FILTER (
        ALL('Sheet1'),
        MONTH ( 'Sheet1'[Month] ) = Next_Month &&
        'Sheet1'[Name] = CurrentName
    )
)

 

 

 

 

 

vjialongymsft_3-1703747837905.png

 

If you want a score for the last two or three months, you can use a similar approach

 

Here’s the result you want

 

vjialongymsft_4-1703747849730.png

Best Regards,

Jayleny

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

 

 

That works, thank you so much 🙂

 

v-jialongy-msft
Community Support
Community Support

Hi @gadielsolis 

 

In response to your question, I have created the following table

vjialongymsft_1-1703668915683.png

 

You can create the measure quartile by using the following formula

Measure = IF(MAX('Table'[Score])>0.9,"Top",IF(MAX('Table'[Score])>0.8,"Mid",IF(MAX('Table'[Score])>0.7,"Mid Bottom",IF(MAX('Table'[Score])<=0.7,"Bottom"))))

 

You can use the following formula to get the score for the next month

NextMonthScore = 
 var _date= EDATE(MAX('Table'[date]),1)
 RETURN CALCULATE(SUM('Table'[Score]),FILTER(ALL('Table'),'Table'[date]=_date))

 

If you want a score for the last two or three months, you can use a similar approach

 

Here’s the result you want

 

 

vjialongymsft_0-1703668893019.png

 

If I misunderstand what you mean, please provide some example input data and outputs

 

Best Regards,

Jayleny

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

 

Fowmy
Super User
Super User

@gadielsolis 

Sharing a dummy Power BI file representing your scenario would be beneficial. You can save the Power BI file on Google Drive or any other cloud storage platform and provide the link here. Kindly ensure that permission is granted to open the file.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

andrewpirie
Resolver II
Resolver II

Are you able to share more details of how the data and what the problem looks like, for example, a screenshot of a table with example data and a screenshot of this issue occurring on the report?

 

Also, I think Score is a measure, if so, are you able to provide the code for the measure? I'm worried it may be a measure that is returning a value you don't intend it to. You'd be able to test this by adding a maximum value to that IF condition - e.g.  IF([Score]>0.9 && [Score] <= 1 ,"Top" and seeing if you get a different result.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.