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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cumulative total by date

I feel like this should be an easy one.

 

I have a yield column (unpivoted), adjoined by columns for products and years (ie. each row shows yield for a product in a given future year, but all yield values in a single column). I would like the formula for expected cumulative total yield by year, so that I can show a table with product rows and year columns, with cumulative totals filling the table.

 

Some products have more extensive data than others, with yield data extending for more years.

 

I have tried the formula below, but the total seems to stop working at the lowest max year across all products, rather than continuing up to the max year for each product individually.

 

CumTotal =
CALCULATE(
    SUM('Data'[Value]),
    FILTER(
        ALLSELECTED('Data'[Year]),
        ISONORAFTER('Data'[Year], MAX('Data'[Year]), DESC)
    )
)

 

Thanks
1 ACCEPTED SOLUTION
Anonymous
Not applicable

The problem was with the Value column I was trying to sum, rather than the formula per se. Fixed now. Thanks

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

The problem was with the Value column I was trying to sum, rather than the formula per se. Fixed now. Thanks

Hi @Anonymous ,

Could you please mark your post as Answered since the problem has been fixed? And it will be great if you can share the solution here. It will help the others in the community find this solution easily when they face the same problem with you. Thank you.

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Measure in the original post works fine (which is the version suggested as a quick measure for rolling total). The issue was with the way the my Value column was filtered in power query, which has nothing to do with the functioning of the measure itself.

parry2k
Super User
Super User

@Anonymous when working with dates and using time intelligence it is a best practice to add a date dimension in your model and use that for time intelligence calculations. You can add date dimension by following my blog post here  Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutions and then update your measure to use date from date dimension table and in visualization use Year from the date dimension table. 

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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