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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ritarita
Regular Visitor

Power BI how to create a table visual with cells that compare difference between different column?

I have two tables (sales #1 and sales#2) that I can use to get a matrix shows total sales each month. However, what I really want is a format like this: 

ritarita_0-1748586907697.png

 

 

 

 

Monthly sales can be easily generated by each table, but how do I get the difference for March 2025, April 2024 and April 2023 compared with April 2025 to display like this?

 

I would also want to have a separate table only showing the "Total", the total would be the sum of Sales#1 and Sales#2. 

 

Note that Sales#1 and Sales# are in two separate tables and no common schema. 

 

This can be easily done in Excel but I don't know how to do this in Power BI.

 

Any idea would be appreciated. Thanks.

1 ACCEPTED SOLUTION

Hi @ritarita ,

Please go through pbix file

Best Regards, 
Menaka.
Community Support Team 

View solution in original post

11 REPLIES 11
v-menakakota
Community Support
Community Support

Hi @ritarita ,

Thanks for reaching out to the Microsoft fabric community forum. 

 

I would also take a moment to thank @burakkaragoz , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
Since Sales#1 and Sales#2 are in separate tables, using a Date table and the TREATAS function in your measures is the right way to align both datasets by date without needing direct relationships.

If I misunderstand your needs or you still have problems on it, please feel free to let us know.   

Best Regards, 
Menaka.
Community Support Team  



ryan_mayu
Super User
Super User

@ritarita 

you need to have date table and try to use DATEADD function to get same month last year and same month two years ago

https://learn.microsoft.com/en-us/dax/dateadd-function-dax?wt.mc_id=DP-MVP-5004616

 

if this can't solve your issue, pls provide some sample data.

 

 





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

Proud to be a Super User!




burakkaragoz
Community Champion
Community Champion

Hi @ritarita ,

 

You can definitely achieve this in Power BI, even if Sales#1 and Sales#2 are in separate tables with no shared dimension. Here's a step-by-step approach:

  1. Create a Date Table
    First, create a proper Date table and mark it as a date table. This will help align both datasets by Month/Year.

  2. Create Relationships (if possible)
    If your sales tables have a date column, create inactive relationships to the Date table (since they’re from different sources). If not, you can still use TREATAS in measures.

  3. Create Measures
    Define measures for each sales table using CALCULATE and TREATAS to align them by date:

   Sales1_Total = 
   CALCULATE(
       SUM(Sales1[Amount]),
       TREATAS(VALUES('Date'[Date]), Sales1[Date])
   )

   Sales2_Total = 
   CALCULATE(
       SUM(Sales2[Amount]),
       TREATAS(VALUES('Date'[Date]), Sales2[Date])
   )

   Difference = [Sales1_Total] - [Sales2_Total]
  1. Build the Matrix/Table Visual
    Use Month/Year from your Date table as the row, and the three measures as values: Sales1_Total, Sales2_Total, and Difference.

  2. Total Table
    For the total-only table, just use a card or table visual with:

   Total_Sales = [Sales1_Total] + [Sales2_Total]

This setup gives you full flexibility and works even without a direct relationship between the two sales tables.

If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI

Thanks for your answer. Now my next focus is on how to display all measures in a visual exactly like my example. 

 

So I need to have a table with April 2025 sales, March 2025 sales, difference between March 2025 and April 2025, April 2024, Difference between April 2024 and April 2025 and so on so forth. 

 

I can create many measures and put them into a matrix, but I would have many tables showing different sales amount, if I create same measure for each month and also measure for difference, it will end up with too many measures. I was wondering if there is a way to do this dynamically? 

Hi @ritarita ,

Yes, you don’t need to create a separate measure for each month or each difference. You can build a dynamic solution using a disconnected table to define the months and difference logic, and a single measure that adjusts its calculation based on the selected row.

If I misunderstand your needs or you still have problems on it, please feel free to let us know.   

Best Regards, 
Menaka.
Community Support Team  




How can I do this? Can you please advise the disconnected table solution? Thank you in advance.

Hi @ritarita ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster. 

 

Thank you. 

Hi  @ritarita ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so that other community members can find it easily. 

 
Thank you. 

Hi @ritarita ,

Please go through pbix file

Best Regards, 
Menaka.
Community Support Team 

Apologies for the delay and thanks for your answer. I haven't had a chance to go through it in details. I would like to to do a bit more testing. I was wondering if I can keep asking questions after I accept as solution?

Hi @ritarita ,

We really appreciate your efforts and for letting us know the update on the issue. If you have any issues after accepting the solution, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.

Thank you.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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