Forum Discussion

gjensen's avatar
gjensen
Frequent Visitor
3 years ago
Solved

Filter looking at 2 measures not working.

I can't provide the actual data as some of it is sensitive.    My goal is to look at customers that have positive values for two measured conditions.  Both Cummulative HBO and Total Streaming chec...
  • DataInsights's avatar
    DataInsights
    3 years ago

    gjensen,

     

    Thanks for the pbix. Try this measure:

     

    Distinct Count Combined = 
    VAR vRunningTotal =
        CALCULATETABLE (
            ADDCOLUMNS (
                VALUES ( 'TEST CHARGES'[BI_ACCT] ),
                "@CumulativeHBO", [Cummulative HBO],
                "@CumulativeTotalStream", [Cummulative Total Stream]
            ),
            'Test Charges Date Table'[Date] <= MAX ( 'Test Charges Date Table'[Date] )
        )
    VAR vActiveCustomers =
        SELECTCOLUMNS (
            FILTER ( vRunningTotal, [@CumulativeHBO] = 1 && [@CumulativeTotalStream] = 1 ),
            "BI_ACCT", 'TEST CHARGES'[BI_ACCT]
        )
    VAR vResult =
        CALCULATE ( DISTINCTCOUNT ( 'TEST CHARGES'[BI_ACCT] ), vActiveCustomers )
    RETURN
        vResult