Forum Discussion

BugmanJ's avatar
BugmanJ
Icon for Helper V rankHelper V
2 years ago
Solved

Filter AND and ALL conditions

Hi there,

Simplistic Data setup:

Order NumberTime Taken to BakeOven


On my page, I am tryin to build a Filter to

  • Count the number of Unique Orders
  • filtered where time taken to bake is >0 and less then 25
  • AND applies to all ovens (currently the page has an Oven filter applied)

So at present, I have this:

Number of Cakes Under 25 Mins =
CALCULATE(
    DISTINCTCOUNT('Table'[Order Number]),
    FILTER
        (
      'Table',
      'Table'[Time Taken to Bake]<25
        && 'Table'[Time Taken to Bake]>0
        &&   ALL('Table'[Oven])
        )        
However, by using ALL, causes a failure with "A table of multiple values was supplied where a single value was expected"

How can i get this to work please?
  • JohnnySaade thanks but that didnt work, but it did make me look further. In the end, I needed an extra CALCULATE for it to work

    CALCULATE(
    CALCULATE(
        DISTINCTCOUNT('Table'[Order Number]),
        FILTER
            (
          'Table',
          'Table'[Time Taken to Bake]<25
            && 'Table'[Time Taken to Bake]>0
             )),
    REMOVEFILTER('Table'[Oven])
            )

2 Replies

  • Try this (You have added it to the criteria instead of adding it as an additional filter context):

    Number of Cakes Under 25 Mins =
    CALCULATE(
        DISTINCTCOUNT('Table'[Order Number]),
        FILTER
            (
          'Table',
          'Table'[Time Taken to Bake]<25
            && 'Table'[Time Taken to Bake]>0),
    ALL('Table'[Oven])
            )
  • JohnnySaade thanks but that didnt work, but it did make me look further. In the end, I needed an extra CALCULATE for it to work

    CALCULATE(
    CALCULATE(
        DISTINCTCOUNT('Table'[Order Number]),
        FILTER
            (
          'Table',
          'Table'[Time Taken to Bake]<25
            && 'Table'[Time Taken to Bake]>0
             )),
    REMOVEFILTER('Table'[Oven])
            )