Forum Discussion

GuldagerHerDK's avatar
GuldagerHerDK
Frequent Visitor
4 years ago
Solved

Distinct count IDs from query, where IDs NOT in other query

Hi. I'm having trouble with counting a certain amount of IDs based on a date input.  It works great when i run one query at a time.  I want to exclude all the ids from VAR DoNotWithtake when coun...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi GuldagerHerDK ,

    In your formula bellow, “DoNotWithtake” returns a number of count, while “MeteringPointID” is the content of ID, they don’t have an inclusive relationship.

     

    You can modify “DoNotWithtake” like this:

    VAR _Table=

    FILTER (

    CALCULATETABLE ( VALUES ( FactSA ), ALL ( 'Dato' ) ),

    FactSA[SAStartDate] >= CALCULATE ( MIN ( Dato[Dato] ) )

    && FactSA[SAStartDate] < SAStartDatePlusTwoMonths

    && FactSA[SAEndDate] >= SAEndDatePlusOneMonth

    ),

    FILTER ( SA, NOT ( SA[SA status] IN { "Canceled", "Pending Start" } )

    )

    VAR _DoNotWithtake =

    SELECTCOLUMNS(_Table, “ Metering Point ID”, [Metering Point ID])

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.