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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
kcantor
Community Champion
Community Champion

Is this Possible? DAX many to many

Okay, this one is a tough one for me but is probably very simple for some of the DAX gurus on this page.

I have two fact tables: Campaigns and Sales.  Normally I use one item table for the sales facts that is based upon item number and then associates manufacturer and product catagory. The campaign table has both of those listings  but not an item number which means it is a many to many connection which doesn't work too well. In order to calculate totals, I broke the item table into two pieces: Manufacturer and Product. Some campaigns have a manufacturer but not a product and some have a product and not a manufacturer. I would like to use this data to apply a weighted amount to manufacturers for product campaigns that do not have a manufacturer. I have given these generic names in order to build a foundation. What I don't know how to do is to bring the two look ups together. I would like to divide the product spend by the number of manufacturers for that product and assign it to the manufacturer to add to manufacturer specific totals.

Sample data:

Campaign Spend:

CampaignTotal Spend
Caps125
Gowns230
Shoes551
Dresses321
A625
B741
C525
D112

 

Manufacturer

Manufacturers Mfg Specific spend
A625
B741
C525
D112

 

Product weighted

ProductsManufacturerWeighted Spend
CapsA62.5
CapsC62.5
GownsB76.66
GownsC76.66
GownsD76.66
ShoesA137.75
ShoesB137.75
ShoesC137.75
ShoesD137.75
DressesC160.5
DressesD160.5

 

Desired Outcome

ManufacturerTotal Spend
A825.25
B955.41
C962.41
D486.91




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

Proud to be a Super User!




1 ACCEPTED SOLUTION
kcantor
Community Champion
Community Champion

I ended up flattening this report through a series of other reports which I then imported as a dataset. It does require a series of refreshes instead of a single but it works.





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

Proud to be a Super User!




View solution in original post

9 REPLIES 9
Neuro81
Helper I
Helper I

maybe its late , maybe i've not quite understood what you were trying to get at but you can get your desired outcome like this

ts:=CALCULATE(SUM(Manufacturer[Mfg Specific spend]))+CALCULATE(SUM('Product weighted'[Weighted Spend]),FILTER(CROSSJOIN('Product weighted',Manufacturer),'Product weighted'[Manufacturer]=Manufacturer[Manufacturers]))

-- ------------------------------ --
Please mark solutions as complete when your question has been answered
-- ------------------------------ --
Sean
Community Champion
Community Champion

@kcantor I believe you can do this with Summarize again Smiley Happy

 

I tested with your data then added some additional refreshed and it seems to work...

But then again I don't know if this would work for you... Let me know.

SUMMARIZE 2.png

kcantor
Community Champion
Community Champion

@Sean

 

This doesn't seem to be helping me as my data is more complex than this simple set of example data. Can I send you  an actual sample?





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

Proud to be a Super User!




Sean
Community Champion
Community Champion

@kcantor I just had the feeling it would not Smiley Sad - it was just too easy...

 

As far resources I think we all learn from Marco and Alberto's Books and very helpful site

and same applies to Rob Collie's Books and website - which I've seen you recommend too Smiley Happy

kcantor
Community Champion
Community Champion

I do use those books and sites as well. I have messaged you a copy of the data. Hopefully you can guide me to what I am doing wrong.





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

Proud to be a Super User!




kcantor
Community Champion
Community Champion

So, what I have done . .

I added a calculation to determine how many manufacturers exist within a catagory. I added a calculated column to determine if an ad group had a related manufacturer. I created a calculation dividing the sum of ad group costs where "had mfg" = 0 to determine how much to add to each mfg within a catagory. Now I just have to figure out how to apply that amount automatically across the board.

messy

cumbersome

ugly

 

Any ideas?





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

Proud to be a Super User!




kcantor
Community Champion
Community Champion

Win a shirt . . . solve my problem to earn points. 🙂

In other words  "BUMP"





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

Proud to be a Super User!




kcantor
Community Champion
Community Champion

I ended up flattening this report through a series of other reports which I then imported as a dataset. It does require a series of refreshes instead of a single but it works.





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

Proud to be a Super User!




Sean
Community Champion
Community Champion

Glad you got it working! This data set was a nightmare - blanks, negative values in what seemed like every field in every table Smiley Happy

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.