Forum Discussion

mauroanelli's avatar
mauroanelli
Helper I
8 years ago
Solved

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?

  • 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]
        )
    

6 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    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]
        )