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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
joemac130
Regular Visitor

DAX Semantic error

VERY NEW to DAX and trying to work my way through...  Need assistance understanding the following error condition...

Here is the DAX that I have created which returns the following error - I have followed examples on the "Error" page but still not getting it correct...

 

Essentially I have a 2 column table (as below) and I would like to use the MonthIndex as the "Intervals" value of the DATEADD function...  The MonthIndex will be used as a Slicer in the Excel Pivot and will drive the date range for a report selection...

 

The initial input to the DATEADD is the calculated value...

Joe Reporting End Date:=Max('Depletions Calendar'[Date]) 

 

MonthIndex CustomerPeriodDays
1                   30
2                   60
3                   90
4                  120
5                  150
6                  180
7                  210
8                  240
9                  270
10                300
11                330
12               360

DAX Semantic error: A function ‘CALCULATE’ has been used in a true-false expression that is used as a table filter expression. This is not allowed.


Joe Reporting Start Date :=

DATEADD (
    [Joe Reporting End Date],
    CALCULATE (
        COUNTROWS ( CustomerReportingPeriod ),
        FILTER (
            ALL ( CustomerReportingPeriod[MonthIndex] ),
            CustomerReportingPeriod[MonthIndex]
                MIN ( CustomerReportingPeriod[MonthIndex] )
        )
    ),
    MONTH
)
 
Any assistance is greatly appreciated.
1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@joemac130

 

Are Joe Reporting End Date and Joe Reporting Start Date measures? The error doesn't occur in the case that they are both calculated column. According to the BOL, DATEADD(<dates>,<number_of_intervals>,<interval>),  the first parameter <dates> should be a date column, if it is a measure in your case, the error occurs based on my test. 

 


Joe Reporting Start Date :=

DATEADD (
    [Joe Reporting End Date],
    CALCULATE (
        COUNTROWS ( CustomerReportingPeriod ),
        FILTER (
            ALL ( CustomerReportingPeriod[MonthIndex] ),
            CustomerReportingPeriod[MonthIndex]
                MIN ( CustomerReportingPeriod[MonthIndex] )
        )
    ),
    MONTH
)

 

 

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee

@joemac130

 

Are Joe Reporting End Date and Joe Reporting Start Date measures? The error doesn't occur in the case that they are both calculated column. According to the BOL, DATEADD(<dates>,<number_of_intervals>,<interval>),  the first parameter <dates> should be a date column, if it is a measure in your case, the error occurs based on my test. 

 


Joe Reporting Start Date :=

DATEADD (
    [Joe Reporting End Date],
    CALCULATE (
        COUNTROWS ( CustomerReportingPeriod ),
        FILTER (
            ALL ( CustomerReportingPeriod[MonthIndex] ),
            CustomerReportingPeriod[MonthIndex]
                MIN ( CustomerReportingPeriod[MonthIndex] )
        )
    ),
    MONTH
)

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.