TOPN of 3 Other Columns

bglaugh

New Member
Joined
Jun 29, 2009
Messages
3
I'm fairly new to PBI so please be gentle. I know Excel and VBA so any DAX input should be fine, I'm just not used to PBI terminology or syntax yet.

So, I have a dataset that is simple, but huge (5million+ rows). It is set up basically like this (not actual data):

MonthLocationItemQuantityCost per itemOverall Cost
JanuaryBuilding 1Spade5£10£50
JanuaryBuilding 1Bucket1£4£4
JanuaryBuilding 1Sponge4£0.50£2
JanuaryBuilding 1Cloth7£1.50£10.50
JanuaryOffice 2Cloth9£1.50£13.50
JanuaryOffice 2Bucket3£4£12
JanuaryOffice 2Ladder4£15£60
JanuaryOffice 2Sponge2£0.50£1
JanuaryOffice 2Bag5£3£15
FebruaryBuilding 1Bucket3£4£12
FebruaryBuilding 1Cloth4£1.50£6
FebruaryBuilding 1Ladder1£15£15
FebruaryBuilding 1Sponge7£0.50£3.50
FebruaryOffice 2Spade8£10£80
FebruaryOffice 2Bucket7£4£28
FebruaryOffice 2Cloth2£1.50£3
FebruaryOffice 2Vehicle1£1000£1000
FebruaryOffice 2Sponge1£0.50£0.50
FebruaryOffice 2Bag8£3£24

All I need to do I provide the top spend per month per building. I'd like to be able to choose the building from a slicer and provide the following results:

Sicer option: Building 1
MonthItemHighest Overall Cost
JanuarySpade£50
FebruaryLadder£15

Slicer option: Office 2
MonthItemHighest Overall Cost
JanuaryLadder£60
FebruaryVehicle£1000

I basically understand TOPN and can create a table containing the highest overall spend for the entire dataset (or the top n results), but can't work out how to split it by month or how to slice it by building. It feels like it should be simple.

Any ideas?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
If you have a slicer set up for the Location column and a linked Table visual displaying the Month, Item, and Overall Cost columns, you're almost there.

From that, I'd open my Filters pane, filter by the Overall Cost, Top N, enter 1 for my n, and add Overall Cost to the field to rank by under "by value."
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top