Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

FILTER with measures

Hi I have a maesure calculated by columns, but I need to filter that by some months only, not the whole year, but everytime I add the filter function I recibe an error

 

Average Procesed Time = -('Table'[DateArrived] - 'Table'[DateProc])
 
I' ve tried to add it before and after, but formula is not working 
 
Average Procesed Time = FILTER(-('Table'[DateArrived] - 'Table'[DateProc]), Table[Month] = "1 & 2 & 3 & 4 & 5 & 6"
 
Average Procesed Time =
VAR APT = -('Brasil Transactions'[DateArrived] - 'Brasil Transactions'[DateProc])
RETURN
CALCULATE( APT, FILTER('Brasil Transactions','Brasil Transactions'[Month] = "1" & "2" & "3" & "4" & "5"))
*The error in here is that I can't use values of type integer and text, the dates are "Date" and the month is "whole number"

1 Reply

  • Hi Anonymous 

     

    Try the following code:

     

    Average Procesed Time =
    VAR APT = - ( 'Brasil Transactions'[DateArrived] - 'Brasil Transactions'[DateProc] )
    RETURN
        CALCULATE (
            APT,
            FILTER (
                'Brasil Transactions',
                'Brasil Transactions'[Month] IN { 1, 2, 3, 4, 5 }
            )
        )

    when you are using the syntax "1"&"2" you are creating a text value so if month is number the comparision is not possible.