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
TomasPac
Helper I
Helper I

Creating a calendar link between sales and purchases

Hello, I have three tables on SQL server:

1. Sales 

2. Purchases

3. Product ID table

Now I want to make a chart that would show Sales vs Purchases through years on axis (from 2015, till today). Sale and purchase table has creation date column for every entry that has been created, but those dates are diferent from each other. Also sales and purchases are linked through their product id to the product ID table. Main question, how can I show sales and purchases on the same chart and compare them by years/months. I tried to create a custom calendar table but I can not create good linking between them..

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table and build a relationship from the Date column of the Sales and Purchase Table to the Date column of the Calendar Table.  In your Calendar Table, extract Year and Month by using these calculated column formulas: Year = YEAR(Calendar[Date]) and Month = FORMAT(Calendar[Date],"mmmm").  To your visual, drag Year and Month from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Create a Calendar Table and build a relationship from the Date column of the Sales and Purchase Table to the Date column of the Calendar Table.  In your Calendar Table, extract Year and Month by using these calculated column formulas: Year = YEAR(Calendar[Date]) and Month = FORMAT(Calendar[Date],"mmmm").  To your visual, drag Year and Month from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

HI @TomasPac ,

Can you please share some sample data tables with same data structure?

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.