Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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:
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.
Solved! Go to Solution.
Hi @ritarita ,
Please go through pbix file
Best Regards,
Menaka.
Community Support Team
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
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.
Proud to be a Super User!
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:
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.
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.
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]
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.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
55 | |
54 | |
54 | |
37 | |
29 |
User | Count |
---|---|
77 | |
62 | |
45 | |
40 | |
40 |