cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeffr
New Member

chart with start and end date

I would like to create a line chart based on data that only has a start and end date.

 

Here is a sample of the data

 

Type Start Date End Date

IW12/01/201712/31/2017
IW12/01/201712/31/2017
JL12/01/201712/31/2017
JL12/01/201712/14/2017
EC12/15/201712/31/2017
IW12/01/201712/24/2017

 

Ideally it would group based on Type and then create a line chart with the Y Axis as Type and the X-Axis would be the Start Date to the End Date range.  Then for each day in between start and end it would have the Count of Type.

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @jeffr,

 

You can try to use below formula to generate the detail date table, then build relationship between original table and new table. After these steps, you can use new date form new table as the axis and drag id to value field with summary mode count.

 

Original table:
1.PNG

 

Sample:

Detail = 
VAR temp =
    SELECTCOLUMNS (
        'Sample',
        "Index", [Index],
        "StartDate", [StartDate],
        "EndDate", [EndDate]
    )
VAR vCalendar =
    CALENDAR ( MINX ( temp, [StartDate] ), MAXX ( temp, [EndDate] ) )
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( temp, vCalendar ),
            [StartDate] <= [Date]
                && [EndDate] >= [Date]
        ),
        "Index", [Index],
        "StartDate", [StartDate],
        "EndDate", [EndDate],
        "Detail", [Date]
    )

Expand tableExpand tableRelationshipRelationship

Create line chart with above columns:

4.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User III
Super User III

Hi,

 

You have reposted this question.  I had shared my solution in your previous post.  Here is the download link to my solution.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-shex-msft
Community Support
Community Support

Hi @jeffr,

 

You can try to use below formula to generate the detail date table, then build relationship between original table and new table. After these steps, you can use new date form new table as the axis and drag id to value field with summary mode count.

 

Original table:
1.PNG

 

Sample:

Detail = 
VAR temp =
    SELECTCOLUMNS (
        'Sample',
        "Index", [Index],
        "StartDate", [StartDate],
        "EndDate", [EndDate]
    )
VAR vCalendar =
    CALENDAR ( MINX ( temp, [StartDate] ), MAXX ( temp, [EndDate] ) )
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( temp, vCalendar ),
            [StartDate] <= [Date]
                && [EndDate] >= [Date]
        ),
        "Index", [Index],
        "StartDate", [StartDate],
        "EndDate", [EndDate],
        "Detail", [Date]
    )

Expand tableExpand tableRelationshipRelationship

Create line chart with above columns:

4.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

WolfBiber
Microsoft
Microsoft

hey,

if you goal is to show the time period please refer to following posts:

"Event-in-Progress"

https://community.powerbi.com/t5/Desktop/Count-of-Active-Contracts-by-Start-en-End-date/td-p/94104

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors