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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
LD
Frequent Visitor

Issue on Cumulative Sum

Dear All,

please, I have the following Dataset and I would like to measure the cumulative sum by month of [YTD_in/out]_

 

LD_1-1656000496329.png

 

I try the following structure:

Var LastM = SELECTEDVALUE('Y Projection'[Month])

Var Dep = SELECTEDVALUE('Y Projection'[Department])
Return
CALCULATE(
SUM('Y Projection'[YTD_IN/OUT]),
'Y Projection'[Month]<=LastM && 'Y Projection'[Department]=Dep

 

but the Column [Colonna] didn't show any results, but any error too.

 

Please, How I can Solve?

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@LD 

Please use

=
VAR LastM = 'Y Projection'[Month]
VAR CurrentDepTable =
    CALCULATETABLE (
        'Y Projection',
        ALLEXCEPT ( 'Y Projection', 'Y Projection'[Department] )
    )
RETURN
    SUMX (
        FILTER ( CurrentDepTable, 'Y Projection'[Month] <= LastM ),
        'Y Projection'[YTD_IN/OUT]
    )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

@LD 

Please use

=
VAR LastM = 'Y Projection'[Month]
VAR CurrentDepTable =
    CALCULATETABLE (
        'Y Projection',
        ALLEXCEPT ( 'Y Projection', 'Y Projection'[Department] )
    )
RETURN
    SUMX (
        FILTER ( CurrentDepTable, 'Y Projection'[Month] <= LastM ),
        'Y Projection'[YTD_IN/OUT]
    )
LD
Frequent Visitor

Thank You Tamerj1,

It's fine and the value are exact!!!!

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors