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

append two tables using measure

Hi guys,

 

I have a table which looks like the following:

ProjectphasesstartDate (as a measure)endDate (as a measure)EstCost
Aa11/01/20201/08/2020100
Aa21/08/20201/08/2021200
Aa31/08/20211/11/2021300

In the above tables, Start and End dates are measures and they can be changed by the users based on their selection 

How do I append a dynamic month/year in this table so the result looks something like this:

 

ProjectphasesstartDate (as a measure)endDate (as a measure)EstCostDynmicDate
Aa11/01/20201/08/2020100Jan-20
Aa11/01/20201/08/2020100Feb-20
Aa11/01/20201/08/2020100Mar-20
Aa11/01/20201/08/2020100Apr-20
Aa11/01/20201/08/2020100May-20
Aa11/01/20201/08/2020100Jun-20
Aa11/01/20201/08/2020100Jul-20
Aa21/08/20201/08/2021200Aug-20
Aa21/08/20201/08/2021200Sep-20
Aa21/08/20201/08/2021200Oct-20
Aa21/08/20201/08/2021200Nov-20
Aa21/08/20201/08/2021200Dec-20
Aa21/08/20201/08/2021200Jan-21
Aa21/08/20201/08/2021200Feb-21
Aa21/08/20211/08/2022200Mar-21
Aa21/08/20211/08/2022200Apr-21
Aa21/08/20211/08/2022200May-21
Aa21/08/20211/08/2022200Jun-21
Aa21/08/20211/08/2022200Jul-21
Aa31/08/20211/11/2021300Aug-21
Aa31/08/20211/11/2021300Sep-21
Aa31/08/20211/11/2021300Oct-21
Aa31/08/20211/11/2021300Nov-21

 I need help to expand the table with a dynamic date (which is a date range between start and end dates of phases on a monthly increment). 

thanks

Daxer

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Daxer12 ,

 

1.Create a calendar table. There is no relationship between two tables.

 

Calendar =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2021, 12, 31 ) ),
    "MonthYear",
        FORMAT ( [Date], "MMM" ) & "-"
            & FORMAT ( [Date], "YY" ),
    "Sort", FORMAT ( [Date], "YYYYMM" )
)

 

1.png2.png

 

2.Create a measure and put it into Filters to filter table.

 

Measure =
IF (
    MIN ( 'Calendar'[Date] ) >= 'Table'[startDate]
        && MIN ( 'Calendar'[Date] ) < [endDate],
    1,
    0
)

 

 

3.png

 

You can check more details from here.

 

 

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Daxer12 ,

 

1.Create a calendar table. There is no relationship between two tables.

 

Calendar =
ADDCOLUMNS (
    CALENDAR ( DATE ( 2020, 1, 1 ), DATE ( 2021, 12, 31 ) ),
    "MonthYear",
        FORMAT ( [Date], "MMM" ) & "-"
            & FORMAT ( [Date], "YY" ),
    "Sort", FORMAT ( [Date], "YYYYMM" )
)

 

1.png2.png

 

2.Create a measure and put it into Filters to filter table.

 

Measure =
IF (
    MIN ( 'Calendar'[Date] ) >= 'Table'[startDate]
        && MIN ( 'Calendar'[Date] ) < [endDate],
    1,
    0
)

 

 

3.png

 

You can check more details from here.

 

 

 

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.

amitchandak
Super User
Super User

@Daxer12 , refer if this blog or file can help

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

File , with a different approach

https://www.dropbox.com/s/bqbei7b8qbq5xez/leavebetweendates.pbix?dl=0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

@Daxer12 - So, Open Tickets does this essentially as part of it's calculation, you could just strip out the logic for it. But, basically it uses GENEARATE between the two dates. You would probably need to couple this with some additional logic. Might be better to do in Power Query. Is there a reasonable maximum involved here or how many rows are we dealing with in the base table?

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364#M147



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks mate - there is no min or max limit. 

 

I'll try your suggestion and really hoping it will work 🙂

 

Thanks heaps for your time again

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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