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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
hemann
Helper I
Helper I

DAX query combining data

Hi, I am trying to create the below visual. I have two pieces of data that I need to combine to get the correct results (Data 1 & Data 2). I am ideally looking to create a DAX query to achieve this. I have created a third piece of data, which is the result needed. Can somebody please help with a neat measure!!

hemann_0-1661833157867.png

Data1

hemann_1-1661833204823.png

Data2

hemann_2-1661833233870.png

Data Result

hemann_3-1661833273334.png

 

 

1 ACCEPTED SOLUTION

I tweaked the solution to return a volume of 1 for all records. This was more or less the solution I was looking for, thanks for your help with it. 

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below DAX formula and the attached pbix file.

It is for creating a new table.

 

Result table =
VAR _newtable =
    CROSSJOIN ( VALUES ( Data[Feature] ), VALUES ( 'Product'[Product] ) )
VAR _addcolumns =
    ADDCOLUMNS (
        _newtable,
        "@Result",
            IF (
                COUNTROWS (
                    FILTER (
                        Data,
                        Data[Feature] = EARLIER ( Data[Feature] )
                            && Data[Product] = EARLIER ( 'Product'[Product] )
                    )
                ) <> 0,
                MAXX (
                    FILTER ( 'Product', 'Product'[Product] = EARLIER ( 'Product'[Product] ) ),
                    'Product'[Material]
                ),
                "No Material"
            ),
        "@Volume",
            MAXX (
                FILTER (
                    Data,
                    Data[Feature] = EARLIER ( Data[Feature] )
                        && Data[Product] = EARLIER ( 'Product'[Product] )
                ),
                Data[Volume]
            ) + 0
    )
RETURN
    _addcolumns

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

I tweaked the solution to return a volume of 1 for all records. This was more or less the solution I was looking for, thanks for your help with it. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.