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! Learn more

Reply
Anonymous
Not applicable

Create a table between two dates

Hello people,

 

I need help!

 

I have a spreadsheet in .xls with some data as below that shows allocated people in some tasks:

 

Name        Start date        End dateHours per day
Resource 1        01-01-2021        01-04-2021        2
Resource 2        04-01-2021        04-03-2021        4

 

I need to show this data in a table like this:

 

Name        Date        Hours per day
Resource 1        01-01-2021        2
Resource 1        01-02-2021        2
Resource 1        01-03-2021        2
Resource 1        01-04-2021        2
Resource 2        04-01-2021        4
Resource 2        04-02-2021        4
Resource 2        04-03-2021        4

 

I've tried some ways but I was not able to solve this problem.

 

Please, someone, have any idea how to solve this problem?

 

Thank you!

 

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Create a disconnected date table (no relationships):

 

DataInsights_0-1632837174032.png

 

Create the measures below. The second measure is necessary to calculate totals.

 

Base measure:

Daily Hours Calc = 
VAR vDate =
    MAX ( DimDate[Date] )
VAR vResult =
    IF (
        vDate >= MAX ( FactTable[Start date] )
            && vDate <= MAX ( FactTable[End date] ),
        MAX ( FactTable[Hours per day] )
    )
RETURN
    vResult

 

Totals measure:

Daily Hours = 
VAR vTable =
    ADDCOLUMNS (
        CROSSJOIN ( VALUES ( FactTable[Name] ), VALUES ( DimDate[Date] ) ),
        "@Hours", [Daily Hours Calc]
    )
VAR vResult =
    SUMX ( vTable, [@Hours] )
RETURN
    vResult

 

Create matrix:

 

DataInsights_2-1632837407375.png

 

DataInsights_1-1632837231122.png

 

If you add the Name and Date fields first, you will get the error below. However, once you add the measure, the error will resolve. You can avoid this error by adding the measure first.

 

DataInsights_3-1632837662487.png

 





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

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@Anonymous,

 

Create a disconnected date table (no relationships):

 

DataInsights_0-1632837174032.png

 

Create the measures below. The second measure is necessary to calculate totals.

 

Base measure:

Daily Hours Calc = 
VAR vDate =
    MAX ( DimDate[Date] )
VAR vResult =
    IF (
        vDate >= MAX ( FactTable[Start date] )
            && vDate <= MAX ( FactTable[End date] ),
        MAX ( FactTable[Hours per day] )
    )
RETURN
    vResult

 

Totals measure:

Daily Hours = 
VAR vTable =
    ADDCOLUMNS (
        CROSSJOIN ( VALUES ( FactTable[Name] ), VALUES ( DimDate[Date] ) ),
        "@Hours", [Daily Hours Calc]
    )
VAR vResult =
    SUMX ( vTable, [@Hours] )
RETURN
    vResult

 

Create matrix:

 

DataInsights_2-1632837407375.png

 

DataInsights_1-1632837231122.png

 

If you add the Name and Date fields first, you will get the error below. However, once you add the measure, the error will resolve. You can avoid this error by adding the measure first.

 

DataInsights_3-1632837662487.png

 





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

Proud to be a Super User!




Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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