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
lekkerbek
Helper IV
Helper IV

Revenue per customer

Hi, I'm trying to write a DAX measure where it calculates the average revenue per customer, but I'm getting nowhere 🙂

 

I have 3 tables:

- date table

- sales table

- visitors and buying customers table (just numbers of visitors and buyers each day)

 

Sales table is linked to the date table and the visitors and buying customers table is also linked to the date table.

 

I had hoped the following code would do the trick, but it does not:

Average revenue per customer = CALCULATE(sum(Sales[Revenue]);Date[Date]) / CALCULATE(sum(Visitors[Buyers]);Date[Date])

Does anybody have a clue?

 

 

Thanks in advance.

1 ACCEPTED SOLUTION
konstantinos
Memorable Member
Memorable Member

@lekkerbek Depends what filters you are going to use. Correct me if is a simple approach but average can calculated if devide revenue by customers. 

This is mostly if you try to filter by dates.

 

 

 

Avg Revenue =

VAR  Customers = SUM(Visitors[Buyers])
VAR Revenue = SUM ( Sales[Revenue])

Return

DIVIDE ( Revenue ; customers )

If you need to filter by other columns like Region that needs another approach

Konstantinos Ioannou

View solution in original post

7 REPLIES 7
konstantinos
Memorable Member
Memorable Member

@lekkerbek Depends what filters you are going to use. Correct me if is a simple approach but average can calculated if devide revenue by customers. 

This is mostly if you try to filter by dates.

 

 

 

Avg Revenue =

VAR  Customers = SUM(Visitors[Buyers])
VAR Revenue = SUM ( Sales[Revenue])

Return

DIVIDE ( Revenue ; customers )

If you need to filter by other columns like Region that needs another approach

Konstantinos Ioannou

Thanks that worked excellent!

Vvelarde-altern
New Member

hi @lekkerbek

 

use this dax:

 

AverageRevenueperCustomer =
AVERAGEX (
    SUMMARIZE (
        'Sales-Revenue';
        'Sales-Revenue'[Sales];
        "AverageRevperCustomer"; DIVIDE (
            CALCULATE (
                SUM ( 'Sales-Revenue'[Revenue] );
                FILTER ( 'Sales-Revenue'; 'Sales-Revenue'[Sales] = MAX ( Date[Date] ) )
            );
            CALCULATE (
                SUM ( 'Visitors'[Buyers] );
                FILTER ( 'Visitors'; Visitors[Date] = MAX ( Date[Date] ) )
            )
        )
    );
    [AverageRevperCustomer]
)
If you see from this account is because my first account dont le me post in this thread.

Thanks for your reply. It does not work right now, but will have a look.  I think it's a step in the right direction. 

I use the AVERAGEX DAX formula to calculate my average against another measurement of SUM('Sales'[Revenue])

For me to get around to ensure it's average by customer, here's what I had to do. But this depends on your tables.

 

Total = SUM('Sales'[Revenue])

 

then created another measure

 

Average = AVERAGEX('Date Table',[Total])

 

Hope that helps.

Kris
Vvelarde
Community Champion
Community Champion

AverageRevenueperCustomer =
AVERAGEX (
    SUMMARIZE (
        'Sales-Revenue';
        'Sales-Revenue'[Sales];
        "AverageRevperCustomer"DIVIDE (
            CALCULATE (
                SUM ( 'Sales-Revenue'[Revenue] );
                FILTER ( 'Sales-Revenue'; 'Sales-Revenue'[Sales] = MAX ( Calendario[Date] ) )
            );
            CALCULATE (
                SUM ( 'Visitors'[Buyers] );
                FILTER ( 'Visitors'; Visitors[Date] = MAX ( Calendario[Date] ) )
            )
        )
    );
    [AverageRevperCustomer]
)




Lima - Peru
Vvelarde
Community Champion
Community Champion

hi @lekkerbek

 

Use this to try to solve it:

 

AverageRevenueperCustomer =
AVERAGEX (
    SUMMARIZE (
        'Sales-Revenue';
        'Sales-Revenue'[Sales];
        "AverageRevperCustomer"DIVIDE (
            CALCULATE (
                SUM ( 'Sales-Revenue'[Revenue] );
                FILTER ( 'Sales-Revenue'; 'Sales-Revenue'[Sales] = MAX ( Date[Date] ) )
            );
            CALCULATE (
                SUM ( 'Visitors'[Buyers] );
                FILTER ( 'Visitors'; Visitors[Date] = MAX ( Date[Date] ) )
            )
        )
    );
    [AverageRevperCustomer]
)




Lima - Peru

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.