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
ClemFandango
Advocate II
Advocate II

Create date table between two dates and add a column from another table

Hi there,

 

I would like to create a new date table for every end of month between 31/01/2018 & 31/12/2028, but including the 'country consolidated' field as an extra column found within 'table1' below. The 'country consolidated' field contains just 5 countries, 'England', 'Scotland', 'international' etc.

 

This is an example of 'table1'

ClemFandango_0-1707307510296.png

 

The new table would hopefully look something like this and continue to generate dates between 31/01/2018 & 31/12/2028 for each of the 5 countries found within Table1 'Country Consolidated'. 

DateCountry
31/01/2018England
28/02/2018England
31/03/2018England
30/04/2018England

 

Any idea on the DAX required to generate this date table?

 

Any help eternally appreciated

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@ClemFandango,

 

Try this calculated table:

 

DatesWithCountry =
VAR vCalendar =
    CALENDAR ( DATE ( 2018, 1, 1 ), DATE ( 2028, 12, 31 ) )
VAR vCalendarEOM =
    FILTER ( vCalendar, [Date] = EOMONTH ( [Date], 0 ) )
VAR vCountries =
    VALUES ( Table1[Country Consolidated] )
VAR vResult =
    GENERATE ( vCalendarEOM, vCountries )
RETURN
    vResult

 

DataInsights_0-1707342326793.png

 





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

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Would you be OK with a Power Query solution?  If yes, then share Table1 in a format that can be pasted in an MS Excel file.


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

@ClemFandango,

 

Try this calculated table:

 

DatesWithCountry =
VAR vCalendar =
    CALENDAR ( DATE ( 2018, 1, 1 ), DATE ( 2028, 12, 31 ) )
VAR vCalendarEOM =
    FILTER ( vCalendar, [Date] = EOMONTH ( [Date], 0 ) )
VAR vCountries =
    VALUES ( Table1[Country Consolidated] )
VAR vResult =
    GENERATE ( vCalendarEOM, vCountries )
RETURN
    vResult

 

DataInsights_0-1707342326793.png

 





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

Proud to be a Super User!




Amazing! thanks so much.

 

Sorry for the delay - i thought I had replied to this.

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.