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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

substract in two table

Hi, I'm getting a demand and supply table from excel . 

Are there any method of doing calculation in power query or dax to calcualte the final value of demand-supply. 

The result will be plot in a table of heatmap. 

The value should shown in each month also. 

Anno_1-1669735452744.png

Thanks for the help. 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You may consider using the following steps:

1. Duplicate the table 'Demand' and 'Supply'

vcgaomsft_0-1669792542056.png

2. For the copied table, select the [Item], [Sub] column and unpivot the other columns.

vcgaomsft_1-1669792834129.png

3. Then merge them as a new table:

vcgaomsft_2-1669792898816.png

4. Expand Supply[Value] as [Value.1] and add custom column like:

vcgaomsft_3-1669792999642.png

5. then remove [value] and [value.1] and select the [Attribute] column to pivot the [Custom] column:

vcgaomsft_4-1669793151671.png

6. select [Aug-22] ~ [May-23] column and replace null to 0.

vcgaomsft_5-1669793237671.png

7. result:

vcgaomsft_6-1669793267467.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

You may consider using the following steps:

1. Duplicate the table 'Demand' and 'Supply'

vcgaomsft_0-1669792542056.png

2. For the copied table, select the [Item], [Sub] column and unpivot the other columns.

vcgaomsft_1-1669792834129.png

3. Then merge them as a new table:

vcgaomsft_2-1669792898816.png

4. Expand Supply[Value] as [Value.1] and add custom column like:

vcgaomsft_3-1669792999642.png

5. then remove [value] and [value.1] and select the [Attribute] column to pivot the [Custom] column:

vcgaomsft_4-1669793151671.png

6. select [Aug-22] ~ [May-23] column and replace null to 0.

vcgaomsft_5-1669793237671.png

7. result:

vcgaomsft_6-1669793267467.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

djurecic
Super User
Super User

Hi @Anonymous ,

 You could use Merge Queries in Power query to get supply and demand in the same table. Then create a calculated column that substracts one from the other.

 

You can create a key column of Item & Sub in each table and use those fields for the merge.

 

Here is some additional information:

https://support.microsoft.com/en-us/office/merge-queries-power-query-fd157620-5470-4c0f-b132-7ca2616d17f9

 

Please consider accepting as solution if this answers the question- thanks!

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.