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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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!

3 REPLIES 3
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.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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