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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Split Data rows into multiple rows based on date

Hi All,

 

I have a dataset which has revenue generated by certain clients over their annual cycle since they became a client - for example say 1st April 2021 to 31st March 2022. But could be less or more than a year on some occasions.

I am trying to split revenue for these accounts into calander years and proportion the revenue accordingly. Any idea how to do this in Power Query:

 

So data looks like this:

ClientStart DateEnd DateDuration (Days)Revenue
Client A01/04/202131/03/202236515000
Client B01/01/202131/12/202136520000
Client C01/11/202001/02/202245825000

 

And would like an output like this:

ClientYearDuration (Days)Revenue
Client A202127511301
Client A2022903699
Client B202136520000
Client C2020613330
Client C202136519924
Client C2022321747

 

Cant get my head around how I would do this. Any help would be appreciated.

James 

 

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

here is one possible implementation assuming your data is immutable (ie using calculated columns)

 

 

 

Days =
SUMX(
    FILTER( 'Table', 'Table'[Client] = Cross[Client] ),
    COUNTROWS(
        INTERSECT(
            CALENDAR( [Year] & "-01-01", [Year] & "-12-31" ),
            CALENDAR( [Start Date], [End Date] )
        )
    )
)
Revenue =
[Days]
    * SUMX(
        FILTER( 'Table', 'Table'[Client] = Cross[Client] ),
        [Revenue] / COUNTROWS( CALENDAR( [Start Date], [End Date] ) )
    )

 

lbendlin_0-1673664424753.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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