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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Date filter not working

Hi, I have a problem creating a measure on a report. The report is a long table in which I represent some warehouse values day by day (see the screenshot). 

mag.PNG

I'm trying to insert into a measure a date filter in which I say (for each row of the report):

F - Inventory[Created Date Time] <= (the field date on the report, that is taken from a field of dimensional table D - Date[Date]).

I tried this way:

NEW In Acq Vib Spe = CALCULATE
(
SUMX('F - Inventory','F - Inventory'[Quantity]*'F - Inventory'[Unit Cost]),
'F - Inventory'[Transaction type]="Ordine fornitore",
'D - Warehouse'[Warehouse ID]="B0",
'D - Item'[Type]="Item",
'D - Item'[SpecialUnificato]="Speciale",
'F - Inventory'[Inventory date]="1900-01-01" || 'F - Inventory'[Inventory date]>='D - Date'[Date],
'F - Inventory'[Status ID] IN { "StatusReceipt-3", "StatusReceipt-4", "StatusReceipt-5"},
'F - Inventory'[Created Date Time]<='D - Date'[Date]
)
 
But it's not working. What is the right syntax to include in the formula?
4 REPLIES 4
AntrikshSharma
Super User
Super User

First of all you need to understand that you are using 2 column in a boolean operation.

'F - Inventory'[Created Date Time] in 'F - Inventory'[Created Date Time]<='D - Date'[Date] expands to  

FILTER ( ALL ( 'F - Inventory'[Created Date Time] ), SomeCondition )

Now you are trying to get dates that are in another table, that's not allowed because FILTER & ALL contruct only has one column.  and the same is true for:

'F - Inventory'[Inventory date]="1900-01-01" || 'F - Inventory'[Inventory date]>='D - Date'[Date],

 Are you trying to calculate a rolling total? if yes, you could use:

NEW In Acq Vib Spe =
VAR LastAvailableDate = MAX ( 'D - Date'[Date] )
VAR Result =
    CALCULATE (
        SUMX ( 'F - Inventory', 'F - Inventory'[Quantity] * 'F - Inventory'[Unit Cost] ),
        'F - Inventory'[Transaction type] = "Ordine fornitore",
        'D - Warehouse'[Warehouse ID] = "B0",
        'D - Item'[Type] = "Item",
        'D - Item'[SpecialUnificato] = "Speciale",
        'F - Inventory'[Inventory date] = "1900-01-01"
            || 'F - Inventory'[Inventory date] >= LastAvailableDate,
        'F - Inventory'[Status ID]
            IN { "StatusReceipt-3", "StatusReceipt-4", "StatusReceipt-5" },
        FILTER ( ALL ( 'D - Date'[Date] ), 'D - Date'[Date] <= LastAvailableDate )
    )
RETURN
    Result
amitchandak
Super User
Super User

@Anonymous , Try like

NEW In Acq Vib Spe = CALCULATE
(
SUMX('F - Inventory','F - Inventory'[Quantity]*'F - Inventory'[Unit Cost]),
,
'D - Warehouse'[Warehouse ID]="B0",
'D - Item'[Type]="Item",
'D - Item'[SpecialUnificato]="Speciale",
Filter('F - Inventory','F - Inventory'[Transaction type]="Ordine fornitore" && ('F - Inventory'[Inventory date]="1900-01-01" || 'F - Inventory'[Inventory date]>='D - Date'[Date]) && 'F - Inventory'[Status ID] IN { "StatusReceipt-3", "StatusReceipt-4", "StatusReceipt-5"}  
&& 'F - Inventory'[Created Date Time]<='D - Date'[Date])
)
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi, I tried your solution but the problem is that I cannot insert 'D - Date'[Date]. If I begin to write it suggests me only measures, while 'D - Date'[Date] is a field.

tex628
Community Champion
Community Champion

Looks like you're comparing datetype with string type. Instead of using "1900-01-01", use DATE(1900,1,1).

Br,
J


Connect on LinkedIn

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors