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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Multiple Sale Result by Second Table Values

Hi  Experts

 

Here is the first question which gives me the correct answer for the first part. 

link: https://community.powerbi.com/t5/Desktop/Calculate-Sales-by-Channel-by-Region-by-County-by-Month/m-p...

 

The releationship between FACT Sales Table and Direct Cost Table (see below) is via Channel. Once the forst step has been computated i want to use cost type OCGS and find the corresponding month (if its Jan 20 in Sales table) then Jan 20 in Direct cost table and mulitple the result by the corresponding value from the Direct Cost Table. 

 

i would like to add this step to the calculated Column in the first question. 

 

 

ChannelCost TypeMonth YearValue
OOOOCOGSJan-2035
OOOOCOGSFeb-2032
OOOOCOGSMar-2033
OOOOCOGSApr-2027
OOOOCOGSMay-2010
OOOOCOGSJun-2011
OOOOCOGSJul-209
OOOOCOGSAug-2055
OOOOCOGSSep-2062
OOOOCOGSOct-2039
OOOOCOGSNov-2028
OOOOCOGSDec-2030
1 ACCEPTED SOLUTION

Hi, @Anonymous 

I am not sure if the below works.

 

LookupCost = LOOKUPVALUE( 'Append_Direct Ohds_IAM&OES'[Value], 'Append_Direct Ohds_IAM&OES'[Month], Sales_Data_Master[MonthV2], 'Append_Direct Ohds_IAM&OES'[Year], Sales_Data_Master[Years_In_Date], 'Append_Direct Ohds_IAM&OES'[Channel], Sales_Data_Master[Channel], 'Append_Direct Ohds_IAM&OES'[Country], Sales_Data_Master[Sales_Country], 'Append_Direct Ohds_IAM&OES'[Type of Cost], "4.Purch")

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.


Go to My LinkedIn Page


View solution in original post

17 REPLIES 17
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please try to use the below for the calculated column. I combined it with the previous one.

Please kindly let me know if it works or not.

 

 

newcolunm =
DIVIDE (
Facts[Sales],
CALCULATE (
SUMX ( Facts, Facts[Sales] ),
ALL ( Facts ),
VALUES ( Facts[Channel] ),
VALUES ( Facts[Region] ),
VALUES ( Facts[Year] ),
VALUES ( Facts[Country] )
)
)
*

LOOKUPVALUE (
Costs[Value],
Costs[Month], Facts[Month],
Costs[Year], Facts[Year],
Costs[Channel], Facts[Channel]
)

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.

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.


Go to My LinkedIn Page


Anonymous
Not applicable

Hi Kim Can we amend the following so Cost Type in Cost Table = "4.Purch" where i could specific the selection criteria

Hi, @Anonymous 

I cannot find a link.

Can you share the link again, please?

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.


Go to My LinkedIn Page


Anonymous
Not applicable

link: https://www.dropbox.com/s/wlpgrtig2nuynvl/Test.pbix?dl=0 

 

In my master file Append_Direct Ohds_IAM&OES - i have month year split out...

Kindly just post the DAX not a new file, Please.

 

ref to Sale_Data_Master for the Calculated column Error

Hi, @Anonymous 

Without the source data connected, I cannot use Power Query to split MonthYear column and have Month-Full-Name in order to connect with Sale_Data_Master's Month Column.

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.


Go to My LinkedIn Page


Hi, @Anonymous 

I think you deleted the error column in your Sales Data Master Table.

May I ask,

- Lookupvalue from "Which Table", and bring it to "Where" ??

- In AppendDirect Ohds table, the month name is Jan, Feb, Mar, ... but your Sales Data master Table has January, February, March, ... -> Can I create one more column to match the length of the name?

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.


Go to My LinkedIn Page


Anonymous
Not applicable

Hi Kim yes...you can and I want to lookup value in  AppendDirect Ohds table..just tell me what to do and I'll follow your steps. Don't post another pbix.

 

Where to sale data master.

Hi, @Anonymous 

I am not sure if the below works.

 

LookupCost = LOOKUPVALUE( 'Append_Direct Ohds_IAM&OES'[Value], 'Append_Direct Ohds_IAM&OES'[Month], Sales_Data_Master[MonthV2], 'Append_Direct Ohds_IAM&OES'[Year], Sales_Data_Master[Years_In_Date], 'Append_Direct Ohds_IAM&OES'[Channel], Sales_Data_Master[Channel], 'Append_Direct Ohds_IAM&OES'[Country], Sales_Data_Master[Sales_Country], 'Append_Direct Ohds_IAM&OES'[Type of Cost], "4.Purch")

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.


Go to My LinkedIn Page


Anonymous
Not applicable

thank you sir

Anonymous
Not applicable

What results did you get?

I got all 0.

I don't think it is correct.

😓

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.


Go to My LinkedIn Page


Anonymous
Not applicable

Anonymous
Not applicable

Hold on ill Split the column and upload a new file....10 minutes

Anonymous
Not applicable

Hi Kim - ill upload a link to sample file.

ryan_mayu
Super User
Super User

@Anonymous 

What does your direct cost table look like?

I guess you can try

column=maxx(filter(direct cost table, salestable[channel]=directcosttable[channel]&&salestable[type]=directcosttable[type]&&salestable[month]=directcosttable[month]),directcosttable[value]) * salestable[value]




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

Proud to be a Super User!




AllisonKennedy
Super User
Super User

@Anonymous  Why are you needing this as a calculated column? If you create it as a measure it will use the context of the table you put it in, and when you slice by Month-Year from your DimDate table (assuming you have one???) then it will automatically pull the correct Value from both tables. 

 

Can you share a screenshot of your relationships please?


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Hi Allison - firstly thanks for looking at my question. I'll share a file later on today. Need to strip out sensitive data.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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