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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
karthikv
New Member

Summarising across start and end dates in 2 columns with varying period

I have data in the following format -

 

ItemNoCurrent StatePrevious StateStartDateEndDateAmount
1ActiveYet to Start1-Apr-181-Mar-1810
2ActiveActive1-Apr-181-Mar-1820
3ActiveYet to Start1-Apr-181-Mar-1830
1In ProgressActive1-Mar-181-Jun-1810
2ActiveActive1-Mar-181-Jun-1820
3ActiveYet to Start1-Mar-181-Jun-1830
2In ProgressActive1-Jun-181-Jul-1810
3ActiveYet to Start1-Jun-181-Jul-1810
1ActiveYet to Start1-Jul-181-Oct-1830
2In ProgressActive1-Jul-181-Oct-1820
3ActiveYet to Start1-Jul-181-Oct-1810

 

The users will have Start Date and End Date as the filters along with Current State and Present State. The task is to be able to traverse through the periods and obtain the summarized result.

 

For example, in the above data if we set Start Date as 1-Apr-18 and End Date as 1-Oct-18, Current State - Active, Previous State - Yet To Start, the expected total of 'Amount' should be 120.

 

With the Current State (Active) and Previous State  (Yet to Start) set, the data would be as shown below -

 

ItemNoCurrent StatePrevious StateStartDateEndDateAmount
1ActiveYet to Start1-Apr-181-Mar-1810
3ActiveYet to Start1-Apr-181-Mar-1830
3ActiveYet to Start1-Mar-181-Jun-1830
3ActiveYet to Start1-Jun-181-Jul-1810
1ActiveYet to Start1-Jul-181-Oct-1830
3ActiveYet to Start1-Jul-181-Oct-1810

 

The total aggregated amount is what I am after during the periods Apr to Oct. Start and End Dates across the table would not be in sequence. If user selects say Apr - Jul, then the total amount would be - 10+30+30+10. How should I go about modelling such data?

 

I did go through the forums that describe multi-period reporting but it is not the similar state. Can someone please guide me on this?

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @karthikv

 

I used two disconnected tables to manage the Start and End date filters, which I can then reference in the following measure.  I've attached a PBIX file for you to have a play with, but I think it's close.

 

Measure = 
VAR myStartDate = SELECTEDVALUE('Start Date'[Start Date])
VAR myEndDate = SELECTEDVALUE('End Date'[End Date])
VAR Result = 
    CALCULATE(
        
        SUM('Table1'[Amount]) ,
        FILTER(
            'Table1',
            ('Table1'[StartDate] <= myStartDate && 'Table1'[EndDate] > myStartDate) ||  
            ('Table1'[StartDate] >= myStartDate && 'Table1'[StartDate] < myEndDate) 
            )
    )
RETURN Result

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

1 REPLY 1
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @karthikv

 

I used two disconnected tables to manage the Start and End date filters, which I can then reference in the following measure.  I've attached a PBIX file for you to have a play with, but I think it's close.

 

Measure = 
VAR myStartDate = SELECTEDVALUE('Start Date'[Start Date])
VAR myEndDate = SELECTEDVALUE('End Date'[End Date])
VAR Result = 
    CALCULATE(
        
        SUM('Table1'[Amount]) ,
        FILTER(
            'Table1',
            ('Table1'[StartDate] <= myStartDate && 'Table1'[EndDate] > myStartDate) ||  
            ('Table1'[StartDate] >= myStartDate && 'Table1'[StartDate] < myEndDate) 
            )
    )
RETURN Result

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.