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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.