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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Khomotjo
Helper II
Helper II

Cumulative Measure Returning Errors

Hello Everyone,

 

I am trying to calculate the  total invoiced MTD for the month of April. 

I have used a variable to return the month I want to look at. For some reason this returns  March and April. Howver if I use a no( i.e 4 for April) I get the correct months data returned.

 

Anyone has an idea where I could be going wrong ?

 

Cumulative Invoiced =

 Var period = MONTH(MAX(Movement[EntryDate1]))

RETURN
CALCULATE(
    [Invoiced],
    FILTER(
         ALLSELECTED(Movement[Date]),
     Movement[Date]<=MAX(Movement[Date])&& MONTH(Movement[Date])= period)
    )
1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @Khomotjo ,

 

Try this :

Cumulative Invoiced =
VAR period = MONTH(MAX(Movement[EntryDate1]))
RETURN
CALCULATE(
    [Invoiced],
    FILTER(
        ALL(Movement[Date]),
        Movement[Date] <= MAX(Movement[Date]) && MONTH(Movement[Date]) = period
    )
)

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

View solution in original post

3 REPLIES 3
v-nmadadi-msft
Community Support
Community Support

Hi @Khomotjo,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

shafiz_p
Super User
Super User

Hi @Khomotjo ,

 

Try this :

Cumulative Invoiced =
VAR period = MONTH(MAX(Movement[EntryDate1]))
RETURN
CALCULATE(
    [Invoiced],
    FILTER(
        ALL(Movement[Date]),
        Movement[Date] <= MAX(Movement[Date]) && MONTH(Movement[Date]) = period
    )
)

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

danextian
Super User
Super User

Hi @Khomotjo 

 

Why not use DATESMTD or a time intelligence function but instead use FILTER? Also, in your formula, why reference different date columns - period variable uses EntryDate1?

 

Other than this, please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.