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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

calculate has been used in a True/False error

Currently, I have two tabs;

"Input Change by Customer Last 90 Days"  Showing change in inputs for last 90 days compared to the 90 prior.

"Input Change by Customer Last 180 Days"  Showing change in inputs for last 180 days compared to the 180 prior.

 

I want to combine the two tabs and have a slicer where you can choose 90 or 180 days instead of switching to different tabs.  I created a new table with 90 and 180, created a measure: Days ago = if(HASONEVALUE('Date Blocks'[Block]), min('Date Blocks'[Block]),0)....this measure will display 0 until 90 or 180 is selected, then it will display the selection.

 

I try to replace a hard "90" in the formula in the attached picture with the measure [Days ago] but get this error.  Please advise.

Capture.PNG

1 ACCEPTED SOLUTION
bdymit
Resolver II
Resolver II

Try this:

Work Order's Last 90 Days =
CALCULATE (
    COUNT ( 'WO Master'[DOC_NO] ),
    FILTER ( 'WO Master', 'WO Master'[Enter Date] > ( TODAY () - [Days ago] ) )
)

The reason is because you are trying to use a measure ([Days ago]) in a CALCULATE FILTER argument, without explicitly calling FILTER.

 

This does not trigger the necessary context transition that needs to occur in order to use a measure in a CALCULATE FILTER argument.

 

more info here https://powerpivotpro.com/2012/06/filter-when-why-how-to-use-it/

 

You could also place your measure in a variable, and then reference that. The variable will calculate your measure, and then save the result as a value that you can do a boolean (True/False) filter on. 

 

Work Order's Last 90 Days =
VAR daysago = [Days ago]
RETURN
    CALCULATE (
        COUNT ( 'WO Master'[DOC_NO] ),
        'WO Master'[Enter Date]
            > ( TODAY () - daysago )
    )

Let me know if this helps!

View solution in original post

2 REPLIES 2
bdymit
Resolver II
Resolver II

Try this:

Work Order's Last 90 Days =
CALCULATE (
    COUNT ( 'WO Master'[DOC_NO] ),
    FILTER ( 'WO Master', 'WO Master'[Enter Date] > ( TODAY () - [Days ago] ) )
)

The reason is because you are trying to use a measure ([Days ago]) in a CALCULATE FILTER argument, without explicitly calling FILTER.

 

This does not trigger the necessary context transition that needs to occur in order to use a measure in a CALCULATE FILTER argument.

 

more info here https://powerpivotpro.com/2012/06/filter-when-why-how-to-use-it/

 

You could also place your measure in a variable, and then reference that. The variable will calculate your measure, and then save the result as a value that you can do a boolean (True/False) filter on. 

 

Work Order's Last 90 Days =
VAR daysago = [Days ago]
RETURN
    CALCULATE (
        COUNT ( 'WO Master'[DOC_NO] ),
        'WO Master'[Enter Date]
            > ( TODAY () - daysago )
    )

Let me know if this helps!

Anonymous
Not applicable

Perfect.  Thank you!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors