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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
oscarca
Helper I
Helper I

How to create a YTD aggregation as a calculated column in Power BI ?

Hello Community,
I am trying to create a calculated column in a calculated table that aggregates Invoiced Quantity year to date for each Period in the table. So for example Period 202307 should summarize the values between 202301 and 202307 and 202308 should summarize the values between 202301 and 202308 etc. But I don't seem to get the logic to work quite properly because If I choose the Period 202307 it will only return the value for that month and not the sum of 202301 - 202307.
My example consists of one fact table "Fact_sales" and two dimension tables "Dim_Calendar" and Dim_Item:

CalculatedTable = 
SUMMARIZE (
    Fact_sales,
    Dim_Calendar[Fiscal period],
    Dim_Calendar[Fiscal year],
    Dim_Customer[Customer],
    Dim_Item[Item number],
    "YTD_InvoicedQty",
        CALCULATE (
            SUM ( Fact_sales[Invoiced quantity - basic U/M] ),
            FILTER (
                ALL ( Dim_Calendar ),
                Dim_Calendar[Fiscal year] = VALUES(Dim_Calendar[Fiscal year]) &&
                Dim_Calendar[Fiscal period] <= MAX(Dim_Calendar[Fiscal period])
            )
        )
)

All help are appreciated!
Best regards,
Oscarca
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Why are you even attempting to solve this with a calculated column?  Why not with a measure?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Have you considered using a Quick Measure for this?

 

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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