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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
shantanugupta
Frequent Visitor

Cumulative sum that resets every financial year

Our financial year start from July to June. I want a cummlative sum that resets every financial year. I went through almost all the threads here and tried the formulas with no luck. Here is my DAX code:

 
Measure =
CALCULATE (
SUM ( v_Usage[Used] ),
FILTER (
ALL ( v_Usage ),
v_Usage[UsageDate] <= MAX ( v_Usage[UsageDate] )
&& v_Usage[Year] = MAX ( v_Usage[Year] )
)
)
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @shantanugupta ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a calculated column as below to get the financial year

Financial Year = 
IF (
    MONTH ( 'v_Usage'[UsageDate] ) >= 7,
    YEAR ( 'v_Usage'[UsageDate] ) & "-"
        & YEAR ( 'v_Usage'[UsageDate] ) + 1,
    YEAR ( 'v_Usage'[UsageDate] ) - 1 & "-"
        & YEAR ( 'v_Usage'[UsageDate] )
)

yingyinr_0-1646041525556.png

2. Create a measure as below to get the culmulative values by financial year

Measure = 
CALCULATE (
    SUM ( v_Usage[Used] ),
    FILTER (
        ALLSELECTED ( v_Usage ),
        v_Usage[UsageDate] <= MAX ( v_Usage[UsageDate] )
            && v_Usage[Financial Year] = SELECTEDVALUE ( v_Usage[Financial Year] )
    )
)

yingyinr_1-1646041591404.png

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.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @shantanugupta ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

1. Create a calculated column as below to get the financial year

Financial Year = 
IF (
    MONTH ( 'v_Usage'[UsageDate] ) >= 7,
    YEAR ( 'v_Usage'[UsageDate] ) & "-"
        & YEAR ( 'v_Usage'[UsageDate] ) + 1,
    YEAR ( 'v_Usage'[UsageDate] ) - 1 & "-"
        & YEAR ( 'v_Usage'[UsageDate] )
)

yingyinr_0-1646041525556.png

2. Create a measure as below to get the culmulative values by financial year

Measure = 
CALCULATE (
    SUM ( v_Usage[Used] ),
    FILTER (
        ALLSELECTED ( v_Usage ),
        v_Usage[UsageDate] <= MAX ( v_Usage[UsageDate] )
            && v_Usage[Financial Year] = SELECTEDVALUE ( v_Usage[Financial Year] )
    )
)

yingyinr_1-1646041591404.png

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.
amitchandak
Super User
Super User

@shantanugupta ,with help from a date table and time intelligence

 

YTD Sales = CALCULATE(SUM ( v_Usage[Used] ),DATESYTD('Date'[Date],"6/30"))

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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