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
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
v-yuta-msft
Community Support
Community Support

@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)

1.PNG 

 

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

2.PNG 

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.

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@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)

1.PNG 

 

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

2.PNG 

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.

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.