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! Request now

Reply
lemaribdb
Helper II
Helper II

DAX DATESINPERIOD moving to different measure issue

Hi guys!

I have below DAX measure and it works correctly.

Date Range Text =
VAR MaxDate = MAX(X_Calendar[DATE])
VAR SelectedPeriod = 'X_Relative Period'[Selected Months Back Number]
VAR Range = DATESINPERIOD('X_Relative Calendar'[DATE], MaxDate, -SelectedPeriod, MONTH)
VAR StartDate = MINX(Range, 'X_Relative Calendar'[DATE])
VAR EndDate = MAXX(Range, 'X_Relative Calendar'[DATE])
RETURN
FORMAT(StartDate, "yyyy-MM") & " to " & FORMAT(EndDate, "yyyy-MM"

I wanted to move the 3 VARS (so the VAR Range output) to different measure so it can be used by few other measures. When I split this measure into two measures:

Selected Period Range =
VAR MaxDate = MAX(X_Calendar[DATE])
VAR SelectedPeriod = 'X_Relative Period'[Selected Months Back Number]
VAR Range = DATESINPERIOD('X_Relative Calendar'[DATE], MaxDate, -SelectedPeriod, MONTH)
RETURN Range

AND

X_SW Amount Rounded No Zero Relative =
VAR Range = 'X_Relative Period'[Selected Period Range]
RETURN
CALCULATE(
    X_Measures[X_SW Amount Rounded No Zero],
    REMOVEFILTERS(X_Calendar),
    KEEPFILTERS(Range),
    USERELATIONSHIP(X_Calendar[DATE], 'X_Relative Calendar'[DATE]))

I get an error "The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column". Can you advise my why this happens and how to fix it? To my understanding I just split the measure into two. I tried troubleshooting this by creating a calculated column out of the 'Selected Period Range' and apparently a new column with date hierarchy appears there. Can you help me?


1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @lemaribdb 

It seems that in part X_SW Amount Rounded No Zero Relative =

VAR Range = 'X_Relative Period'[Selected Period Range] 

is issue

try to change this, maybe min or max, like VAR Range =MAX( 'X_Relative Period'[Selected Period Range])

 





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

Proud to be a Super User!






View solution in original post

1 REPLY 1
some_bih
Super User
Super User

Hi @lemaribdb 

It seems that in part X_SW Amount Rounded No Zero Relative =

VAR Range = 'X_Relative Period'[Selected Period Range] 

is issue

try to change this, maybe min or max, like VAR Range =MAX( 'X_Relative Period'[Selected Period Range])

 





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

Proud to be a Super User!






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.