Forum Discussion

lchaplen's avatar
lchaplen
Icon for Helper II rankHelper II
4 years ago
Solved

Calculating unique count across two tables values each with conditions.

I have two tables Programs and Benefits.  There are people I need to count uniquely based on conditions in each table Programs:   person is active = 1 and Program = XYZ and startdate = MM/DD/YYY Be...
  • lchaplen's avatar
    lchaplen
    4 years ago

    HI so I cracked it.. one thing to mention in Variables you can't go off another variable.

    TEST HH_Non-Cash_Benefit_w_LIHEAP =
    VAR NonCasha =
    CALCULATETABLE(VALUES('rpt vw_Client_Households'[Household_Code]),FILTER('rpt vw_Client_Non_Cash_Benefits','rpt vw_Client_Non_Cash_Benefits'[Client_Active] = 1 ))
    VAR LIHEAPa =
    CALCULATETABLE(VALUES('rpt vw_Client_Households'[Household_Code]),'rpt vw_Client_Programs'[Program] = "Low Income Heating Assistance")
    VAR Combined_NonCash_LIHEAP = UNION(NonCasha,LIHEAPa)
    VAR Unique_NCandLIHEAP = DISTINCT(Combined_NonCash_LIHEAP)
    RETURN
    Countrows(Unique_NCandLIHEAP)