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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
BlueWhite3699
Helper III
Helper III

Measure take for ever to run

Hi Experts

 

the following measure retuns back the correct return - no issue there. But when applied to a 16million rows of data for one fiscal year its just take forever to return a value back in the matrx table...

 

YTD Forecast (full year) = 
        VAR TEMPTABLE = SUMMARIZE(
			CALCULATETABLE(
				ALLSELECTED('Date'),
				DATESYTD(
					'Date'[Date],
					"31/03"
				)
			),
			'Date'[Month and Year],
			"@Forecast", [Forecast]
		)
		RETURN

			SUMX(
				TEMPTABLE,
				[@Forecast]
			)

 

How can this be modifed to run more fast and better.

 

See sample file

 

https://drive.google.com/file/d/1UzRnZMz2UZS9qhojxQVRjHWs1HnXj4Dr/view?usp=drive_link 

1 ACCEPTED SOLUTION
BlueWhite3699
Helper III
Helper III

YTD Forecast (full year) = 
CALCULATE (
    SUMX (
        ADDCOLUMNS (
            VALUES ( 'Date'[_MonthYearSort] ),
            "@TotalForecast", [Forecast]
        ),
        [@TotalForecast]
    ),
    DATESYTD ( 
        'Date'[Date],
        "31/03"
    ) 
)

View solution in original post

6 REPLIES 6
BlueWhite3699
Helper III
Helper III

YTD Forecast (full year) = 
CALCULATE (
    SUMX (
        ADDCOLUMNS (
            VALUES ( 'Date'[_MonthYearSort] ),
            "@TotalForecast", [Forecast]
        ),
        [@TotalForecast]
    ),
    DATESYTD ( 
        'Date'[Date],
        "31/03"
    ) 
)
BlueWhite3699
Helper III
Helper III

See image as the correct end value 407839, what is the image above is not correct.

BlueWhite3699_0-1743788182106.png

 

rajendraongole1
Super User
Super User

Hi @BlueWhite3699  - 

 

rajendraongole1_0-1743787555208.png

YTD Forecast (full year)_1 =
CALCULATE(
    [Forecast],  
    DATESYTD('Date'[Date], "31/03")  
)
 
check this and let us know.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi - that formula is not going to work on 16million rows of data and based on the model. I have tried that and give the wrong answer

Hi @BlueWhite3699 - can you please check the below logic:

 

rajendraongole1_0-1743788375848.png

 

 

YTD Forecast (full year)_1 =
VAR YTDForecast =
    CALCULATE(
        [Forecast], -- Use SUM directly for performance
        DATESYTD('Date'[Date], "31/03"),
        REMOVEFILTERS('Date')
    )
RETURN YTDForecast




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi Expert - its still incorrect look at my value for Mar 25 407839. thats the correct answer and kindly look at your value

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.