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

Related tables and forcasting

Hello all,

 

I have 2 tables which are related in a Many to 1 by Contract name.   

 

Sales (Many)  = A list of sales to multiple customers with these important columns

Sales numberContract nameProductPrice
1Customer 1Oranges10
2Customer 1Apples50
3Customer 2Oranges2
4Customer 1Oranges34
5Customer 2Oranges56
6Customer 1Apples78
7Customer 1Oranges70
8Customer 1Apples30
9Customer 2Apples10

 

From that I have metrics that work out daily average sales both in volume and cost  (there's a date field which I don't think is important for my question)

 

ContractDate (to 1) = is a simple 3 column table like this

 

Contract NameDate contract endsDays until contract ends
Customer 131/05/2022396
Customer 231/12/2021245
Customer 314/09/2021137
Customer 428/06/202159
Customer 522/05/202122

 

Each customer name only appears once in this list.

 

 

The outcome I want to get to is to be able to group by customer or product name across customers, take my daily average for that product and multiply it by the Days until contract ends value for that customer.  That will let me forecast how many sales and their value until the end of the contract.

 

The trouble I run into is getting each customer's Days until contract ends value into a metric where I can use it.

 

I hope that makes sense and thanks for any help!

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

Here are the steps you can follow:

1. Create calculated column.

Column = RELATED(Table2[Days until contract ends])
Column 2 = 'Table'[Price]*'Table'[Column]

v-yangliu-msft_0-1620112529231.png

2. Create calculated table.

Sales =
SUMMARIZE('Table','Table'[Contract Name],'Table'[Product],"sales",SUM('Table'[Column 2]))

3. Result:

v-yangliu-msft_1-1620112529234.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I am not sure if I understood your question correctly, but please try the below whether it is what you are looking for.

 

Forecast sales =
SUMX(Sales, Sales[Price] * RELATED(ContractDate[Days until contract ends]))
 

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, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

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

@Jihwan_Kim 

 

Yeah that's roughly how simple I thought it would be.  I thought it would be

Daily_Average * RELATED(ContractDate[Days until contract ends])

 

But the measures simply won't allow me to add the Days Until contract ends field in there which is why I am stuck.  I can use it in column calculations, but not measures.   Any ideas on what might be happening?

Hi, @Anonymous 

Thank you for your feedback.

I am not sure how your data model looks like, but please check the relationship between the two tables.

Or, if it is OK with you, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

 

Thanks.

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


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.