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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Marrtine_240
Frequent Visitor

Stacked value with a start and end date

Hi,

 

I have a table that contains, among other things, a start and an end date that has a certain value between those dates. In a visual in Power BI, I would like to see the sum of all lines of that value if it falls between the start and end dates.

Does anyone have an idea how I can solve this? Or is it described somewhere?

Below the table and the desired outcome.

Thanks!

 

RijStartdatumEinddatumWaarde  
11-8-202224-10-20220,6
21-9-202201-10-20220,3
31-9-202201-10-20220,7
415-11-202231-12-20220,6

 

 

Desired outcome.jpgDesired outcome.jpg

 

 

 

 

1 ACCEPTED SOLUTION
Marrtine_240
Frequent Visitor

Hi @Anonymous ,

 

Thank you so much for the push in the right direction. Now I will definitely be able to finish my model. I had tried a lot, but now I see why it didn't work. I already had it working, but via an extra step in Excel, this can now be removed.

 

Martine

View solution in original post

2 REPLIES 2
Marrtine_240
Frequent Visitor

Hi @Anonymous ,

 

Thank you so much for the push in the right direction. Now I will definitely be able to finish my model. I had tried a lot, but now I see why it didn't work. I already had it working, but via an extra step in Excel, this can now be removed.

 

Martine

Anonymous
Not applicable

Hi @Marrtine_240 ,

Please have a try.

Create a calendar date. Then merge the 2 tables.

From the “Get data” drop-down menu, select “Blank Query”. This will open the Power Query Editor window where you will build the table.

Create a list of dates using the formula bar. 

= List.Dates(#date(2022,8,1),153,#duration(1,0,0,0))

Then convert the List into a table by clicking the “To Table” button in the Convert menu on the ribbon. You will not make any selections r in the subsequent window, click “OK”.

Once the List has been converted to a Table, rename the column to “Date Value” and change the data type to a Date type using the data type button next to the column header.

More details about How to Create a Date Table 

 

Then merge the two tables.

vpollymsft_0-1655175060908.png

Then expand the column.

vpollymsft_1-1655175191184.png

 

And change the calendar column type to date.

Finally create a measure.

Measure = 
VAR actived =
    CALCULATE (
        SUM ( Merge1[Waarde  ] ),
        FILTER (
            ALLSELECTED ( Merge1 ),
            Merge1[Calendar.date] <= MAX (Merge1[Calendar.date] )
                && Merge1[Attribute] <> "Einddatum"
        )
    )
VAR Einddatum =
    CALCULATE (
        SUM ( Merge1[Waarde  ]  ),
        FILTER (
            ALLSELECTED ( Merge1 ),
             Merge1[Calendar.date] <= MAX (Merge1[Calendar.date] )
                && Merge1[Attribute]  = "Einddatum"
        )
    )
RETURN
    actived - Einddatum

vpollymsft_2-1655175325689.png

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors