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
BrentonBarnes
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]))

 

Capture.PNG

1 REPLY 1
TeigeGao
Solution Sage
Solution Sage

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,

Teige

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.