cancel
Showing results for
Did you mean:
Highlighted
Anonymous
Not applicable

## Top n function based on increase/decrease in data over time

I want to create a measure that allows me to find the top 5 and bottom 5 for departments over a course of 2 months.

I have already created a measure that finds the percent difference between payments from one month to the next, now I would like to be able to compare and visualize that difference.

I want to find the top 5 deparmets with the greatest increase in payments and the bottom 5 departments with the greatest decrease in payments.

I'm fairly new to Power BI so I am not sure how to go about doing this. Here is a sample of my data:

 DATE DEPARTMENT PAYMENTS Increase/Decrease February 000 12 March 000 2 -83% February 001 312 March 001 463 48% February 002 127 March 002 17 -87%

I really appreciate the help and I thank you all in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Top n function based on increase/decrease in data over time

@Anonymous ,

Please convert Increase/Decrease to calculate column, then create two tables by clicking Modeling-> New Table using DAX below:

`Top 5 Increase = TOPN(5, FILTER('Table', 'Table'[Increase/Decrease] > 0), 'Table'[Increase/Decrease], DESC)`

`Bottom 5 Decrease = TOPN(5, FILTER('Table', 'Table'[Increase/Decrease] < 0), 'Table'[Increase/Decrease], ASC)`

Community Support Team _ Jimmy Tao

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

Community Support Team

## Re: Top n function based on increase/decrease in data over time

@Anonymous ,

Please convert Increase/Decrease to calculate column, then create two tables by clicking Modeling-> New Table using DAX below:

`Top 5 Increase = TOPN(5, FILTER('Table', 'Table'[Increase/Decrease] > 0), 'Table'[Increase/Decrease], DESC)`

`Bottom 5 Decrease = TOPN(5, FILTER('Table', 'Table'[Increase/Decrease] < 0), 'Table'[Increase/Decrease], ASC)`

Community Support Team _ Jimmy Tao

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

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 271 members 3,141 guests
Recent signins: