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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How to use many to one relationships with yearquarter rows

I have three datatables: 

 

1 -  a dates table (having rows with unique values for date (e.g. 2 January 2019) and corresponding quarters (e.g. 2014 Qtr 1), which are not unique.

2 - a table having 1 column with yearquarters (not unique, e.g. 2014 Q1)

3 - a table having 1 column with dates (e.g. 2 January 2019)

 

In my Dashboards are visuals which need to work well with filtering. However, I cannot get the right relationships. One thing that would work is aggregating table 3 over year quarters and summing the values. How can I do that? 

 

Or is there another way of solving this? THanks

1 ACCEPTED SOLUTION

@Anonymous then it is pretty straight forward, we can convert Q1, Q2, Q3, Q4 to respective month and get a date

 

go to query editor and advanced editor, add following function in your code just after the let 

 quarterMonth = (quarterNumber) => 
    let
        q = Text.AfterDelimiter( quarterNumber, " "),
        r = if q = "Q1" then 1 else if q = "Q2" then 4 else if q = "Q3" then 7 else 10
    in
        r,

 

Click done, and now click Custom Column under Add Column menu, and enter following code

 

#date( 
    Number.FromText( Text.BeforeDelimiter( [Quarter], " ")), 
    quarterMonth( [Quarter] ), 
    1 
    )

you will get corresponding date for each quarter, and change type to Date

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

8 REPLIES 8
ChrisMendoza
Resident Rockstar
Resident Rockstar

@Anonymous  -

You should not need to have 3 tables with date type things. You should be able to derive YYYY QQQ M & etc from a single date column with all dates.

 

Possibly provide your file so we may assist.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Thank you Chris, how can I share my file? 

Publich folder: OneDrive, Dropbox, etc.






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



parry2k
Super User
Super User

@Anonymous in table 2 even though you have quarter number, just add a first or last date for quarter and both table 2 and table 3 with have relationship with date table on date. With this everything will flow  nicely from date table.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks Parry, I think this would work indeed!

 

Do you know how I can write the piece of DAX that tranfers my yearquarter to a starting date for example? 

e.g. 2014 Q1 -> 01-01-2014

 

 

@Anonymous is this how your quarer formatted? YYYY Qn



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Yes my year quarter is formatted as: 2017 Q1, 2017 Q2, 2017 Q3, ect. 

@Anonymous then it is pretty straight forward, we can convert Q1, Q2, Q3, Q4 to respective month and get a date

 

go to query editor and advanced editor, add following function in your code just after the let 

 quarterMonth = (quarterNumber) => 
    let
        q = Text.AfterDelimiter( quarterNumber, " "),
        r = if q = "Q1" then 1 else if q = "Q2" then 4 else if q = "Q3" then 7 else 10
    in
        r,

 

Click done, and now click Custom Column under Add Column menu, and enter following code

 

#date( 
    Number.FromText( Text.BeforeDelimiter( [Quarter], " ")), 
    quarterMonth( [Quarter] ), 
    1 
    )

you will get corresponding date for each quarter, and change type to Date

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors