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
herbemischung
Resolver I
Resolver I

Top N measure: Top 10 revenue delta (customers)

Hi all,

 

I am trying to create a measure I want to use with smart narratives:

 

There are a lot of customers (Customers [Customer]) they all have revenue (Sales[revenue])

I created the following measures:

 

Revenue actual year = sum(sales[revenue])

Revenue sum = calculate(sum(sales[revenue]))

Revenue last year = calculate([Revenue sum], dateadd(date[date],-1,YEAR))

Delta Revenue = [Revenue actual year] - [Revenue last year]

 

What I need is a measure that gives me the amount of the 10 customers with the biggest Delta Revenue.

 

I created RankDelta = rankx(ALLSELECTED(Customers[Customer]),[Delta Revenue],,DESC,Dense)

--> this works fine, if I drag Customer, Delta Revenue and RankDelta in a Table, it looks like this:

 

CustomerDelta RevenueRankDelta
A50001
B40002
C10003
D5004
.........

 

Then I hoped to finally create this measure:

TopDelta = calculate([Delta Revenue],filter(Measures,[RankDelta]<11))

But all I am getting is the entire sum of the delta of all customers. The filter is not doing a thing.

 

Got any ideas? I ran out of those. Thanks!

 

 

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @herbemischung 

 

It’s my pleasure to answer for you.

According to your description,I think you can modify your measure.

Like this:

 

TopDelta =
CALCULATE (
    [Delta Revenue],
    FILTER ( ALLSELECTED ( Customer ), [RankDelta] < 11 )
)

 

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

2 REPLIES 2
Anand24
Super User
Super User

Hi @herbemischung ,

 

Here's a Calculated Measure DAX that will help you in your scenario:
Top 10 Delta Summation = CALCULATE(SUM('Customer'[Delta Revenue]),'Customer'[RankDelta] <= 10)

 

Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

v-janeyg-msft
Community Support
Community Support

Hi, @herbemischung 

 

It’s my pleasure to answer for you.

According to your description,I think you can modify your measure.

Like this:

 

TopDelta =
CALCULATE (
    [Delta Revenue],
    FILTER ( ALLSELECTED ( Customer ), [RankDelta] < 11 )
)

 

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

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.