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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
mauroanelli
Helper I
Helper I

split value monthly between two dates

hi all,

i have datas like this 

projectdate startdate endtotal value
a01/01/201831/12/201812
b01/01/201831/12/201812
c01/01/201831/12/201812
d01/01/201831/12/201812

 

i need to split the value by numbers of month and have table like this

projectmonthmonthly value
a01/01/20181
a01/02/20181
a01/03/20181
a01/04/20181
a01/05/20181
a01/06/20181
a01/07/20181
a01/08/20181
a01/09/20181
a01/10/20181
a01/11/20181
a01/12/20181
b01/01/20181
b01/02/20181
b01/03/20181
b01/04/20181
b01/05/20181
b01/06/20181
b01/07/20181
b01/08/20181
b01/09/20181
b01/10/20181
b01/11/20181
b01/12/20181

 

i can do something with M but takes to much. any idea if its possible in dax?

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

Hi @mauroanelli

 

You can try using this calculated Table in DAX

From the Modelling Tab >>>NEW TABLE

 

Table =
VAR temp =
    ADDCOLUMNS (
        GENERATE (
            Table1,
            GENERATESERIES ( MONTH ( Table1[date start] ), MONTH ( Table1[date end] ) )
        ),
        "No_of_Months", DATEDIFF ( Table1[date start], Table1[date end], MONTH ) + 1
    )
RETURN
    SELECTCOLUMNS (
        temp,
        "Project", [project],
        "Month", EOMONTH ( [date start], [Value] - 2 )
            + 1,
        "MonthlyValue", [total value] / [No_of_Months]
    )

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

Hi @mauroanelli

 

You can try using this calculated Table in DAX

From the Modelling Tab >>>NEW TABLE

 

Table =
VAR temp =
    ADDCOLUMNS (
        GENERATE (
            Table1,
            GENERATESERIES ( MONTH ( Table1[date start] ), MONTH ( Table1[date end] ) )
        ),
        "No_of_Months", DATEDIFF ( Table1[date start], Table1[date end], MONTH ) + 1
    )
RETURN
    SELECTCOLUMNS (
        temp,
        "Project", [project],
        "Month", EOMONTH ( [date start], [Value] - 2 )
            + 1,
        "MonthlyValue", [total value] / [No_of_Months]
    )

i'm sorry it seems to works fine but it's not.

it works if you have date from gen to dec but for different dates all goes wrong

for example from 01/03/2018 to 30/06/2018 returns correct montly value but in  may, june, july and august

@mauroanelli

 

Sad to hear this.

 

Please post some sample data and expected result...

Just like you did at the beginning of the post.

 

I will look into it

thanks, look at this. the first row is like the old one, start and ends in the same years, second row i change the start/end and set it across two years

sample1.JPG

this is what i got

sample2.JPG

i think that the problem is within generateseries, because the month start end wont work

thank you very much!!! it works perfectly

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.