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

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

Reply
hemann
Helper I
Helper I

Combine 2 Data sets using measure

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 measure to achieve this. I have created a third piece of data, which is the result needed. Can somebody please help with a neat measure!!

 

Visual Required;

hemann_0-1661738037032.png

Data 1

ProductVolume
11
21
31
41
51
61

 

Data 2 

ProductFeatureFeature QualityVolume
1AHigh1
1BLow1
1CLow1
2AHigh1
2BHigh1
3ALow1
3BHigh1
3CLow1
5ALow1
5CHigh

1

 

Data result (from Data 1 and Data 2)

FeatureProductResultVolume
A1High1
B1Low1
C1Low1
A2High1
B2High1
C2Not Featured1
A3Low1
B3High1
C3Low1
A4Not Featured1
B4Not Featured1
C4Not Featured1
A5Low1
B5Not Featured1
C5High1
A6Not Featured1
B6Not Featured1
C6Not Featured1
1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@hemann 

you can try to do that in PQ

let
    Source = Table.FromColumns( {List.TransformMany(List.Distinct(#"Data 1"[Product]),(a)=>List.Distinct(#"Data 2"[Feature]),(x,y)=>y),List.TransformMany(List.Distinct(#"Data 1"[Product]),(a)=>List.Distinct(#"Data 2"[Feature]),(x,y)=>x)}),
    #"Merged Queries" = Table.NestedJoin(Source, {"Column2"}, #"Data 1", {"Product"}, "Data 1", JoinKind.LeftOuter),
    #"Expanded Data 1" = Table.ExpandTableColumn(#"Merged Queries", "Data 1", {"Volume"}, {"Data 1.Volume"}),
    #"Merged Queries1" = Table.NestedJoin(#"Expanded Data 1", {"Column1", "Column2"}, #"Data 2", {"Feature", "Product"}, "Data 2", JoinKind.LeftOuter),
    #"Expanded Data 2" = Table.ExpandTableColumn(#"Merged Queries1", "Data 2", {"Feature Quality"}, {"Data 2.Feature Quality"}),
    #"Replaced Value" = Table.ReplaceValue(#"Expanded Data 2",null,"Not Featured",Replacer.ReplaceValue,{"Data 2.Feature Quality"})
in
    #"Replaced Value"

 

or you can use DAX to create a table

Table = 
VAR tbl=DISTINCT('Data 1'[Product])
VAR tbl2=DISTINCT('Data 2'[Feature])
VAR tbl3=CROSSJOIN(tbl,tbl2)
VAR tbl4=ADDCOLUMNS(tbl3,"F qulaity",if(maxx(FILTER('Data 2',EARLIER([Feature])='Data 2'[Feature]&&EARLIER([Product])='Data 2'[Product]),'Data 2'[Feature Quality])="","Not Featured",maxx(FILTER('Data 2',EARLIER([Feature])='Data 2'[Feature]&&EARLIER([Product])='Data 2'[Product]),'Data 2'[Feature Quality])),"volumn",maxx(FILTER('Data 1',EARLIER([Product])='Data 1'[Product]),'Data 1'[Volume]))
return tbl4

1.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
hemann
Helper I
Helper I

Thankyou you are a Rockstar. I used the DAX query solution as it processed a little faster...

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

@hemann 

you can try to do that in PQ

let
    Source = Table.FromColumns( {List.TransformMany(List.Distinct(#"Data 1"[Product]),(a)=>List.Distinct(#"Data 2"[Feature]),(x,y)=>y),List.TransformMany(List.Distinct(#"Data 1"[Product]),(a)=>List.Distinct(#"Data 2"[Feature]),(x,y)=>x)}),
    #"Merged Queries" = Table.NestedJoin(Source, {"Column2"}, #"Data 1", {"Product"}, "Data 1", JoinKind.LeftOuter),
    #"Expanded Data 1" = Table.ExpandTableColumn(#"Merged Queries", "Data 1", {"Volume"}, {"Data 1.Volume"}),
    #"Merged Queries1" = Table.NestedJoin(#"Expanded Data 1", {"Column1", "Column2"}, #"Data 2", {"Feature", "Product"}, "Data 2", JoinKind.LeftOuter),
    #"Expanded Data 2" = Table.ExpandTableColumn(#"Merged Queries1", "Data 2", {"Feature Quality"}, {"Data 2.Feature Quality"}),
    #"Replaced Value" = Table.ReplaceValue(#"Expanded Data 2",null,"Not Featured",Replacer.ReplaceValue,{"Data 2.Feature Quality"})
in
    #"Replaced Value"

 

or you can use DAX to create a table

Table = 
VAR tbl=DISTINCT('Data 1'[Product])
VAR tbl2=DISTINCT('Data 2'[Feature])
VAR tbl3=CROSSJOIN(tbl,tbl2)
VAR tbl4=ADDCOLUMNS(tbl3,"F qulaity",if(maxx(FILTER('Data 2',EARLIER([Feature])='Data 2'[Feature]&&EARLIER([Product])='Data 2'[Product]),'Data 2'[Feature Quality])="","Not Featured",maxx(FILTER('Data 2',EARLIER([Feature])='Data 2'[Feature]&&EARLIER([Product])='Data 2'[Product]),'Data 2'[Feature Quality])),"volumn",maxx(FILTER('Data 1',EARLIER([Product])='Data 1'[Product]),'Data 1'[Volume]))
return tbl4

1.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.