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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ansa_naz
Continued Contributor
Continued Contributor

Running total - from start of financial year until end of current month - but doesnt work

It keeps going from the start of the financial year selected in page filter, to the end of the financial year selected in page filter. I need it to go from the start of the financial year selected in page filter, to the end of the current month. My measure is:

 

 

YTD Sales = 

    CALCULATE (
        sum(Revenue[Amount]), 
        DATESYTD(ForecastSalesDate[CalendarDate],"31/10")
    )

 

 

When I select financial year 2020 in page filter, I want it to show from 01/11/2019 upto 30/04/2020 (today is 16/04/2020), but it keeps going to 31/10/2020 (the financial year end):

 

cTjLvGA1tB.jpg 

What I am looking for is:

 

YearMonth2YTD Sales
2019-11656,105
2019-121,032,637
2020-011,732,107
2020-023,904,887
2020-034,973,156
2020-045,064,032

 

The data model is:

 

qAJ2Wky6Pa.jpg

 

Can anyone advise further?

Cheers for all help

1 ACCEPTED SOLUTION
ansa_naz
Continued Contributor
Continued Contributor

Got a solution - add a relative date filter to the page, to only show the last X months of data. Resolved

View solution in original post

6 REPLIES 6
ansa_naz
Continued Contributor
Continued Contributor

Got a solution - add a relative date filter to the page, to only show the last X months of data. Resolved

v-frfei-msft
Community Support
Community Support

Hi @ansa_naz ,

We can use a measure like that to work on it. For more details, please refer to this case.

https://community.powerbi.com/t5/Desktop/Filter-by-date-in-bar-chart/m-p/1026266#M483925

 

Year = 
VAR today =
    TODAY ()
VAR stofyear =
    DATE ( YEAR ( today ), 1, 1 )
VAR spre =
    DATE ( YEAR ( today ) - 1, 1, 1 )
VAR pre =
    EDATE ( today, -12 )
RETURN
    CALCULATE (
        SUM ( 'Table'[value] ),
        FILTER (
            'date',
            OR (
                'date'[Date] >= stofyear
                    && 'date'[Date] <= today,
                'date'[Date] >= spre
                    && 'date'[Date] <= pre
            )
        )
    )

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @v-frfei-msft I have tried your solution as below:

 

YTD Sales Frank =
VAR today =
    TODAY ()
VAR stofyear =
    MIN ( ForecastSalesDate[CalendarDate] )
RETURN
    CALCULATE (
        SUM ( ANSAPBIProjectFRevenue[Amount] ),
        FILTER (
            ForecastSalesDate,
            ForecastSalesDate[CalendarDate] >= stofyear
                && ForecastSalesDate[CalendarDate] <= today
        )
    )

 

However this is not giving me a running total, it just gives me a total of sales per month, and then includes following months also as blank values:

 

Frank1.jpg

What I am trying to get is:

 

YearMonth2YTD Sales
2019-11656,105
2019-121,032,637
2020-011,732,107
2020-023,904,887
2020-034,973,156
2020-045,064,032

Any further ideas would be very helpful please, many thanks

jthomson
Solution Sage
Solution Sage

Could you not use eomonth and today to pull the last date you're into as a variable, and then use that as part of an if statement, returning the existing measure if whatever field you're using is before that date and blank if it's after it?

Greg_Deckler
Community Champion
Community Champion

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler  I went through them, but I couldnt work out a way to use them, thank you for the reply

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors