Forum Discussion

dniedrauer's avatar
dniedrauer
Resolver I
8 years ago
Solved

A function filter has been used in a true/false statement that is used as a filter expression....

I thought the filter function was supposed to get around this error. Ugh. Here is my formula. BTW 'year' is formatted as a number. 

 

calculate(distinctcount(Main[Vessel Imo]),filter(all('Calendar'[Year]),'Calendar'[Year]=max('Calendar'[Year]))

  • Hi dniedrauer,

     

    Try the same formula but remove column name after ALL:

    • calculate(distinctcount(Main[Vessel Imo]),filter(all('Calendar'),'Calendar'[Year]=max('Calendar'[Year]))

    Or as an alternative, you can create Current Year column and compare it against the Calendar Year something like this:

    • Measure 3 = CALCULATE(DISTINCTCOUNT(Sheet1[Item_Rev]),FILTER(ALL(Sheet1),YEAR(Sheet1[Date])=MAX(Sheet1[Year])
      ))

     

    Hope it helps.

     

    Regards

    Abduvali

1 Reply

  • Abduvali's avatar
    Abduvali
    Skilled Sharer

    Hi dniedrauer,

     

    Try the same formula but remove column name after ALL:

    • calculate(distinctcount(Main[Vessel Imo]),filter(all('Calendar'),'Calendar'[Year]=max('Calendar'[Year]))

    Or as an alternative, you can create Current Year column and compare it against the Calendar Year something like this:

    • Measure 3 = CALCULATE(DISTINCTCOUNT(Sheet1[Item_Rev]),FILTER(ALL(Sheet1),YEAR(Sheet1[Date])=MAX(Sheet1[Year])
      ))

     

    Hope it helps.

     

    Regards

    Abduvali