Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Filtering by two conditions

Dear all, I have a table like below: Invoice No               Product Code           Value 50                             101                            200 50                             103    ...
  • vanessafvg's avatar
    vanessafvg
    9 years ago

    Anonymous from what you can see the measure does actually work however it expects some sort of context, 

    for example if you place it on a matrix you would see that the value woudl be summed by invoice number and measure test would show 1 and 1 for invoice 50 and 54

     

    so to use it on a card, i think you actually need to summarise this in a table

     

    try this

     

    Table Test =
    SUMMARIZE (
    Table1,
    Table1[Invoice No],
    "Measure Test", CALCULATE (
    DISTINCTCOUNT ( Table1[Invoice No] ),
    FILTER (
    Table1,
    SUM ( Table1[Value] ) >= 1000
    && SUM ( Table1[Value] ) <= 2000
    && Table1[Product Code] IN { "101", "102" }
    )
    )
    )

  • v-jiascu-msft's avatar
    9 years ago

    Anonymous

     

    Hi,

     

    vanessafvg ‘s formula is wonderful. I just add a few parts. Try this measure please. This can be used in a card visual.

     

    Measure =
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                Table1,
                Table1[Invoice No],
                "Measure Test", CALCULATE (
                    DISTINCTCOUNT ( Table1[Invoice No] ),
                    FILTER (
                        Table1,
                        SUM ( Table1[Value] ) >= 1000
                            && SUM ( Table1[Value] ) <= 2000
                            && Table1[Product Code] IN { 101, 102 }
                    )
                )
            ),
            [Measure Test] = 1
        )
    )

     

     

     

    Best Regards!

    Dale