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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
bourne2000
Helper V
Helper V

How to connect a date column with year?

Hi

 

I have the below table 

 

ItemYearQuarterValue
A2020Q1$274,089.00
A2020Q2$191,325.00
A2020Q3$274,060.00
A2020Q4$324,888.00
B2020Q1$78,949.00
B2020Q2$47,211.00
B2020Q3$75,718.00
B2020Q4$86,363.00
C2020Q1$195,140.00
C2020Q2$144,114.00
C2020Q3$198,342.00
C2020Q4$238,526.00
D2020Q1$81,932.00
D2020Q2$60,593.00
D2020Q3$80,480.00
D2020Q4$91,777.00
E2020Q1$23,015.00
E2020Q2$14,036.00
E2020Q3$20,381.00
E2020Q4$23,635.00
F2020Q1$58,917.00
F2020Q2$46,557.00
F2020Q3$60,099.00
F2020Q4$68,141.00
A2021Q1$315,366.00
A2021Q2$319,847.00
A2021Q3$273,215.00
A2021Q4$336,087.00
B2021Q1$90,077.00
B2021Q2$93,754.00
B2021Q3$81,714.00
B2021Q4$93,416.00
C2021Q1$225,290.00
C2021Q2$226,093.00
C2021Q3$191,500.00
C2021Q4$242,671.00
A2021Q1$92,444.00
A2021Q2

$93,697.00

 

I want to calculate the Quarter to Date. I created a date table, when I connected it's coming many to many. Can anyone advise how to create a date table and connect with only year value?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @bourne2000 ,

 

 

Date =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2021, 12, 31 ) ),
    "Year-Quarter",
        YEAR ( [Date] ) & " Q"
            & QUARTER ( [Date] )
)

 

 

vstephenmsft_0-1644311708458.png

 

In the fact table, create a yearquarter column.

 

Year-Quarter = [Year]&" "&[Quarter]

 

vstephenmsft_1-1644311789062.png

The relationship is as follows.

vstephenmsft_0-1644311869216.png

It must be a many-to-many relationship, because there are multiple same year-quarter columns in the date table corresponding to multiple year-quarter columns in the fact table.

 

You can also filter out the year-quarter columns as a table.

Date2 =
DISTINCT (
    SELECTCOLUMNS (
        CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2021, 12, 31 ) ),
        "Year-Quarter",
            YEAR ( [Date] ) & " Q"
                & QUARTER ( [Date] )
    )
)

vstephenmsft_1-1644312071005.pngvstephenmsft_2-1644312099359.png

 

 

Best Regards,

Stephen Tao

 

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

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @bourne2000 ,

 

 

Date =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2021, 12, 31 ) ),
    "Year-Quarter",
        YEAR ( [Date] ) & " Q"
            & QUARTER ( [Date] )
)

 

 

vstephenmsft_0-1644311708458.png

 

In the fact table, create a yearquarter column.

 

Year-Quarter = [Year]&" "&[Quarter]

 

vstephenmsft_1-1644311789062.png

The relationship is as follows.

vstephenmsft_0-1644311869216.png

It must be a many-to-many relationship, because there are multiple same year-quarter columns in the date table corresponding to multiple year-quarter columns in the fact table.

 

You can also filter out the year-quarter columns as a table.

Date2 =
DISTINCT (
    SELECTCOLUMNS (
        CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2021, 12, 31 ) ),
        "Year-Quarter",
            YEAR ( [Date] ) & " Q"
                & QUARTER ( [Date] )
    )
)

vstephenmsft_1-1644312071005.pngvstephenmsft_2-1644312099359.png

 

 

Best Regards,

Stephen Tao

 

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

 

Ashish_Mathur
Super User
Super User

Hi,

You should create a seperate table with 2 columns (Quarter and Month Name[the first month of the quarter]).  Create a relationship from the Quarter column of your fact table to the Quarter column of the new table.  Write a RELATED() function in a calculated column to bring over the first month of the quarter in the Fact Table.  In the Fact Table, write this calculated column formula to generate a Date

Date = 1*("1/"&Data[First Month of quarter]&"/"&Data[Year])

Now create a Calendar Table and build a relationship from the Date column of the Fact Table to the Date column of the Calendar Table.


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

Hi @bourne2000 

 

A Date table will always connect to a Fact table using a Date field.  

 

If you want to calculate quarters, you can use the following:

 

Measure = CALCULATE ( SUM ( Table[Amount] ) , DATESQTD ( 'Date'[Date] ) )

 

Hope this helps!


Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@TheoC  Thanks for your quick reply. I don't have a date column in my facts table. How to do this?

Hi @bourne2000 

 

Unfortunately, with the data you have presented in your table, it is hard to tell you how to add a date to it because your data should have it included.  The other thing is that your table already has the Quarter to Date calculated given there is now lower level of detail that your data table has recorded (i.e. it only has YEAR and the Q1-Q4).  Therefore, the Quarter is already being presented.

 

Does your data have a Day, Month and Year?

 

Thanks,

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors