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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Syndicate_Admin
Administrator
Administrator

Create a graph with calculated values between 2 tables per week

Hello everyone

I want to generate a graph using values from two tables per week

Table 1 Table 2
Component 1WeekValue Component 2WeekValue
A112.00 A218.00
A113.00 A215.00
A115.00 B214.00
B112.00 B214.00
B114.00 B213.00
A122.00 C214.00
A125.00 C212.00
B126.00 B226.00
C124.00 B225.00
C125.00 B224.00
A147.00 C221.00
B143.00 C222.00
B148.00 A138.00
B141.00 B237.00
B144.00 C234.00
C145.00 C233.00
C142.00 A245.00
C141.00 A246.00
B244.00
B244.00
C243.00
C241.00

For the graph, the values are given by subtracting the weekly average of each component subtracted from a constant.

ProductComponent 1Component 2Fromula to Chart
AA1A2A=(10)-(A1 - A2)
BB1B2B=(11)-(B1 - B2)
CC1C2C=(15)-(C1 - C2)

The problem is that there are weeks when you don't have a component, in that case you don't graph the value of that week

WeekAverage A1Average B1Average C1 Average A2Average B2Average C2
13.333.67N/A 6.503.673.00
23.506.004.50 N/A5.001.50
3N/AN/AN/A 8.007.003.50
47.004.002.67 5.504.002.00
Calculation
WeekProduct AProduct BProduct C
113.1711.00
2 10.0012.00
3
48.5011.0014.33

The graph would look something like this:

Billy_82476344_0-1718920513764.png

I hope you can help me

Best regards

1 ACCEPTED SOLUTION

Hello

Thank you very much for the answer, I had to adjust the graph a little so that it was identical to what I need, there was something that did not fit me but it was a mistake of mine in the table, but the answer is correct

Thank you and greetings!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,@Syndicate_Admin 

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

vlinyulumsft_0-1718959280795.png

vlinyulumsft_1-1718959288990.png

2.Create calculated table references:

Table = UNION('Table1','Table2')

3.Create calculated column references:

Average A1 = CALCULATE(AVERAGE('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Week]),'Table'[Component 1]="A1"))
Average A2 = CALCULATE(AVERAGE('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Week]),'Table'[Component 1]="A2"))
Average B1 = CALCULATE(AVERAGE('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Week]),'Table'[Component 1]="B1"))
Average B2 = CALCULATE(AVERAGE('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Week]),'Table'[Component 1]="B2"))
Average C1 = CALCULATE(AVERAGE('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Week]),'Table'[Component 1]="C1"))
Average C2 = CALCULATE(AVERAGE('Table'[Value]),FILTER(ALLEXCEPT('Table','Table'[Week]),'Table'[Component 1]="C2"))
Product A = IF('Table'[Average A1]&&'Table'[Average A2],
10-'Table'[Average A1]+'Table'[Average A2],BLANK())
Product B = IF('Table'[Average B1]&&'Table'[Average B2],
11-'Table'[Average B1]+'Table'[Average B2],BLANK())

Product C = IF('Table'[Average C1]&&'Table'[Average C2],
15-'Table'[Average C1]+'Table'[Average C2],BLANK())

4.Here's my final result, which I hope meets your requirements.

vlinyulumsft_2-1718959472530.png

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

 

 

 

Hello

Thank you very much for the answer, I had to adjust the graph a little so that it was identical to what I need, there was something that did not fit me but it was a mistake of mine in the table, but the answer is correct

Thank you and greetings!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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