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
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
v-stephen-msft
Community Support
Community Support

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
v-stephen-msft
Community Support
Community Support

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.

Greg_Deckler
Super User
Super User

@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


@ 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!:
The Definitive Guide to Power Query (M)

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
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.

Top Solution Authors