Forum Discussion

LeaRupnik's avatar
LeaRupnik
Icon for Helper III rankHelper III
5 years ago
Solved

Cumulativa withaut data table

Hello, 

I have an example  with cumulative  but the sum I would like a cumulative by year. 

 

 

 

Kumulativa_real_cpp:=
var prava_vrednost = MAX('cisppr vw_CistaProdajnaPremija'[Za leto/mesec VR])
return
CALCULATE([Real nab količina_f], ALLSELECTED('cisppr vw_CistaProdajnaPremija'), 'cisppr vw_CistaProdajnaPremija'[Za leto/mesec VR]<=prava_vrednost
)

 

thx

 

Lea

  • Hi, LeaRupnik 

     

    According to your description, I think you can modify your measure.

    Like this:

    Measure =
    SUMX (
        SUMMARIZE (
            'Table',
            [Year],
            "a",
                SUMX (
                    FILTER ( ALL ( 'Table' ), [Year] = SELECTEDVALUE ( 'Table'[Year] ) ),
                    [Value]
                )
        ),
        [a]
    )

    If it doesn’t solve your problem, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • you need to add another variable that identifies the year on the current "row". Then add that to your CALCULATE filters.

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Icon for Community Support rankCommunity Support

    Hi, LeaRupnik 

     

    According to your description, I think you can modify your measure.

    Like this:

    Measure =
    SUMX (
        SUMMARIZE (
            'Table',
            [Year],
            "a",
                SUMX (
                    FILTER ( ALL ( 'Table' ), [Year] = SELECTEDVALUE ( 'Table'[Year] ) ),
                    [Value]
                )
        ),
        [a]
    )

    If it doesn’t solve your problem, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.