Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Dynamic filter using Source.Name

I have a production order dataset with past and future dates. I want to calculate the sum of delivered, and sum of ordered quantity for ONLY the dates equal to or prior to the report run date (I want to avoid summing open production orders that are not yet due). I am using a file naming convention with date as integer as the first 8 digits. Example: 20190815_ProductionOrd.xlsx

I created a column with the this formula: Report Date = LEFT('ProdOrd'[Source.Name],8) to return 20190815 on all rows.

I also have a date table (relationship built) with "date as integer" as one of the columns


I'm having trouble writing a formula that will use the MAX('Report Date') in the filter expression. I can't get CALCULATE or FILTER to accept the numeric value MAX('Report Date') which would be 20190815. I keep getting the error - A function 'MAX' has been used in a True/False expression that is used as a table filter expression


FY19 Act = CALCULATE(SUM('ProdOrd'[Delivered quantity (GMEIN)]),'Date'[Date As Integer]<=MAX('ProdOrd'[Report Date]))



TeigeGao Solution Sage
Solution Sage

Re: Dynamic filter using Source.Name

Hi @BrentonBarnes ,

In your scenario, you can set a variable to store the result of MAX('Report Date'), then use the variable in the DAX query.

Best Regards,


Helpful resources

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors