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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Dshami
Frequent Visitor

Issue with Forecast DAX measure

I have a scenario to show the Expenses data for selected year and unselected months( if month selected as January, It should show Expenses of February to December for selected year, for multiple selections same functioning).

I have created two dax as below

 

1. End Date = MAX(Calendar [Date])

( Max calendar date is last day of current year)

 

2. Exp Forecast = CALCULATE ( SUM( Table [Sales]), DATESBETWEEN(Calendar [Date], DATE(YEAR([End Date]), MONTH ([End Date])+1,01), DATE(YEAR([End Date]),12,31)))

 

But the catch is with this second measure with no month selection and only year selection it gives me blank values. If no month selection I need the Expense to be shown for all months. 

What changes are supposed to be done?

 

Would really appreciate help on this..

Thanks in advance!

 

 

 

 

 

1 ACCEPTED SOLUTION
MAwwad
Solution Sage
Solution Sage

The reason you are seeing blank values with the Exp Forecast measure when no month is selected is because the DATESBETWEEN function is not receiving any dates to filter by. To show expenses for all months in the selected year when no month is selected, you can modify the Exp Forecast measure as follows:

Exp Forecast = IF(ISFILTERED(Calendar[Month]), CALCULATE(SUM(Table[Sales]), DATESBETWEEN(Calendar[Date], DATE(YEAR([End Date]), MONTH([End Date])+1, 1), DATE(YEAR([End Date]), 12, 31)) ), CALCULATE(SUM(Table[Sales]), DATESBETWEEN(Calendar[Date], DATE(YEAR([End Date]), 1, 1), DATE(YEAR([End Date]), 12, 31)) ) )

This measure uses the ISFILTERED function to check if the Month column is being filtered. If it is, then the original calculation using DATESBETWEEN is used. If it is not being filtered, then the calculation is modified to show expenses for all months in the selected year by changing the start date to January 1st of the selected year.

I hope this helps!

View solution in original post

1 REPLY 1
MAwwad
Solution Sage
Solution Sage

The reason you are seeing blank values with the Exp Forecast measure when no month is selected is because the DATESBETWEEN function is not receiving any dates to filter by. To show expenses for all months in the selected year when no month is selected, you can modify the Exp Forecast measure as follows:

Exp Forecast = IF(ISFILTERED(Calendar[Month]), CALCULATE(SUM(Table[Sales]), DATESBETWEEN(Calendar[Date], DATE(YEAR([End Date]), MONTH([End Date])+1, 1), DATE(YEAR([End Date]), 12, 31)) ), CALCULATE(SUM(Table[Sales]), DATESBETWEEN(Calendar[Date], DATE(YEAR([End Date]), 1, 1), DATE(YEAR([End Date]), 12, 31)) ) )

This measure uses the ISFILTERED function to check if the Month column is being filtered. If it is, then the original calculation using DATESBETWEEN is used. If it is not being filtered, then the calculation is modified to show expenses for all months in the selected year by changing the start date to January 1st of the selected year.

I hope this helps!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors