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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
LexLong
Regular Visitor

Cumulative sum based on different conditions halfway through the year

I am having some trouble with a special cumulative function that requires the conditions of the function to change at a specific point in the year. Unfortunately, due to company policy, I do not have the ability to use Google Drive or other file sharing services to provide the data, so I will do my best to provide all of the information here. I would also like to preface this by saying I am new to Power BI so if my measure seems a bit chaotic, please forgive me. The only part of the measure/table that I cannot show is the "Entity" field due to sensitive information. I have attached the photos of the columns used in the measure below. I provided the main measure code below. 

 

The first half of the measure calculates everything correctly. However, the second half is where it produces an incorrect sequence of values. Essentially, we need the first half of the year to sum using the "Version IFRS Budget Rate" version criteria, which it does correctly. Then, the second half of the year (from July onwards) needs to add on to the first half (on the cumulative from up until June) using the "OL Quarter 2" version criteria. It is almost correct, but the one fault is that it does not continue the accumulation between June and July. Up until June, it is correct, and it shows a cumulative function starting with the July numbers. However, July is not added on to June, thus restarting the cumulative sequence.

The quarter and outlook columns are blank for months that are not used. Quarter is the normal business quarter in a year. Outlook represents the "mirror" of quarter, so to speak. So Q1 would be January to March. The corresponding outlook would be April to December. For Q2, the corresponding outlook would be July to December, and so on. I hope I have provided enough information but please do not hesitate to request more if needed. Once again, I apologise for the inability to provide data via sharing platforms as this is blocked on my end. 

 

Combined.png

Outlook Dummy.png  Q2 Dummy.pngOutlooks and Quarters.png

 

 

Cumulative Outlook Q2 = 
IF(NOT(ISBLANK('Fact Project Amounts'[Q2 Dummy])),
CALCULATE(
    SUM('Fact Project Amounts'[Amount]),
    FILTER(
        ALLSELECTED('Fact Project Amounts'[Time],'Fact Project Amounts'[Entity_corrected],'Fact Project Amounts'[Q2]),
        'Fact Project Amounts'[Q2] <= MAX('Fact Project Amounts'[Q2])),
        ALLSELECTED('Fact Project Amounts'[Time],'Fact Project Amounts'[Entity_corrected],'Fact Project Amounts'[Month]),
        'Fact Project Amounts'[Month] <=6,
        'Fact Project Amounts'[Version] = "Version IFRS Budget Rate",
        'DimDate'[Year] = 2023
))
+ 
IF(NOT(ISBLANK('Fact Project Amounts'[Outlook 2 Dummy])), 
CALCULATE(
    SUM('Fact Project Amounts'[Amount]),
    FILTER(
        ALLSELECTED('Fact Project Amounts'[Time],'Fact Project Amounts'[Entity_corrected],'Fact Project Amounts'[Outlook 2]),
        'Fact Project Amounts'[Outlook 2] <= MAX('Fact Project Amounts'[Outlook 2])),
        ALLSELECTED('Fact Project Amounts'[Time],'Fact Project Amounts'[Entity_corrected],'Fact Project Amounts'[Month]),
        'Fact Project Amounts'[Month] >= 7,
        'Fact Project Amounts'[Version] = "OL Quarter 2",
        'DimDate'[Year] = 2023
        ))

 

 

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Top Solution Authors