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

View all the Fabric Data Days sessions on demand. View schedule

Reply
apohl1
Helper II
Helper II

Creating a DAX Measure to Combine Volume Data and ASP for Product Sales Report with Aggregation

I need assistance in creating a DAX measure that combines volume data by product code (stored in Dataset 1) with the Average Selling Price (ASP) (stored in Dataset 2). The product codes in Dataset 2 are linked to Dataset 1 via a separate table (Dataset 3), which contains the equivalent product codes and has a direct relationship with Dataset 2.

 

The goal is to generate a report that displays sales based on volume from Dataset 1 and ASP from Dataset 2. The DAX measure should calculate sales per product code, and it should also be capable of aggregating these individual sales figures to provide a total sales amount across all product codes.

 

Thank you in advance for your help!

1 ACCEPTED SOLUTION

Hi @apohl1,

Please try the DAX measure below. I received the following output.

Total Sales =
SUMX (
    VALUES ( 'Volume Data'[ProductCode] ),
    VAR Volume =
        CALCULATE ( SUM ( 'Volume Data'[Volume] ) )
    VAR ASP =
        CALCULATE (
            AVERAGE ( 'ASP Data'[ASP] ),
            TREATAS ( VALUES ( 'Volume Data'[ProductCode] ), 'Mapping Table'[ProductCode] )
        )
    RETURN
        Volume * ASP
)

vsaisraomsft_0-1758518202230.png

 

Thank you.

View solution in original post

6 REPLIES 6
v-saisrao-msft
Community Support
Community Support

Hi @apohl1,

Checking in to see if your issue has been resolved. let us know if you still need any assistance.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @apohl1,

Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further

 

Thank you.

apohl1
Helper II
Helper II

Thank you! Unfortunately, I should have clarified that each product code has multiple rows, so the LOOKUPVALUE function doesn't work in this context. I tried the DAX below, but it's not summing the total correctly and it's not very efficient in terms of performance.

 

Total Sales =
SUMX(
    SUMMARIZE(
        'Dataset1',
        'Dataset1'[Product code],
        "Volume", SUM('Dataset1'[Volumes])
    ),
    VAR ProductCode = 'Dataset1'[Product code]
    VAR Volume = SUM('Dataset1'[Volumes])
    VAR ASP =
        CALCULATE(
            Dataset2[ASP],
            RELATEDTABLE('Dataset3'),
            'Dataset3'[Product code] = ProductCode
        )
    RETURN
        Volume * ASP)

Hi @apohl1,

Please try the DAX measure below. I received the following output.

Total Sales =
SUMX (
    VALUES ( 'Volume Data'[ProductCode] ),
    VAR Volume =
        CALCULATE ( SUM ( 'Volume Data'[Volume] ) )
    VAR ASP =
        CALCULATE (
            AVERAGE ( 'ASP Data'[ASP] ),
            TREATAS ( VALUES ( 'Volume Data'[ProductCode] ), 'Mapping Table'[ProductCode] )
        )
    RETURN
        Volume * ASP
)

vsaisraomsft_0-1758518202230.png

 

Thank you.

This worked! Thank you so much!! 

v-saisrao-msft
Community Support
Community Support

Hi @apohl1,

I’ve recreated the issue using sample data and configured the model with Volume, ASP, and a Mapping table. After setting up the relationships and creating the DAX measure, I obtained the expected output. I’ve attached the PBIX file for your reference.

Total Sales = 
SUMX (
    'Volume Data',
    'Volume Data'[Volume] *
        LOOKUPVALUE (
            'ASP Data'[ASP],
            'ASP Data'[ProductCode2],
            RELATED ( 'Mapping Table'[ProductCode2] )
        )
)

vsaisraomsft_0-1758283122219.png

Thank you.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.