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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.