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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
GreenP
Regular Visitor

Contribution of Top Performers in DAX

Dear Experts,

 

I have a table like below:

ZoneBrandCustomerBill Amount
NORTHBRAND-002[1000000216]100
EASTBRAND-002[1000000229]91
EASTBRAND-002[1000000231]44
NORTHBRAND-002[1000000280]40
EASTBRAND-001[1000000220]39
NORTHBRAND-002[1000000257]33
NORTHBRAND-002[1000000220]29
EASTBRAND-001[1000000216]22
EASTBRAND-002[1000000477]22
NORTHBRAND-001[1000000414]19
EASTBRAND-001[1000000229]12
EASTBRAND-002[1000000230]10
NORTHBRAND-001[1000000400]10
EASTBRAND-002[1000000230]8
NORTHBRAND-002[1000000400]8
EASTBRAND-001[1000000230]6
NORTHBRAND-001[1000000248]5
NORTHBRAND-001[1000000231]4
EASTBRAND-001[1000000224]3
EASTBRAND-001[1000000231]2
NORTHBRAND-001[1000000406]2
NORTHBRAND-001[1000000229]0.5

 

I need to calculate a measure - Total Billed Amount for Top 3 Customers and want to plot the measure for each Zone.

Brand can be selected from a slicer (Multiple selection).

 

I am expecting the following table when all Brands are selected:

ZoneBilled Amount (Top 3 Customers)
EAST188
NORTH173

 

I am expecting the following table when only BRAND-001 is selected in slicer:

ZoneBilled Amount (Top 3 Customers)
EAST73
NORTH34

 

If anyone can help me with the DAX to calculate the measure it would be of great help.

 

Thanks.

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @GreenP 

try to plot the zone column and a measure like this:

Top3Amt = 
CALCULATE(
    SUM(TableName[Bill Amount]),
    TOPN(
        3,
        ALL(TableName[Customer]),
        CALCULATE(SUM(TableName[Bill Amount]))
    )
)

 

verified and worked like this:

FreemanZ_2-1675238607985.png

FreemanZ_3-1675238617657.png

 

 

 

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @GreenP 

try to plot the zone column and a measure like this:

Top3Amt = 
CALCULATE(
    SUM(TableName[Bill Amount]),
    TOPN(
        3,
        ALL(TableName[Customer]),
        CALCULATE(SUM(TableName[Bill Amount]))
    )
)

 

verified and worked like this:

FreemanZ_2-1675238607985.png

FreemanZ_3-1675238617657.png

 

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors