Forum Discussion

MFR2023's avatar
MFR2023
Frequent Visitor
3 years ago
Solved

Distinct Count Customers with Filters based on Measures

Hello,   I've only been using Power BI and Dax for a few months and I've reached the stage of having very specific questions    I'm trying to filter a distinct count of customer names by a minimu...
  • lbendlin's avatar
    3 years ago

    Welcome to the world of variables and aggregator functions!

     

    Ratio = 
    var a = SUMMARIZE('Table',[Customer Name],"1st 4Q",sum('Table'[Sales 1st 4Q]),"2nd 4Q",sum('Table'[Sales 2nd 4Q]),"All 8",sum('Table'[Sales all 8]))
    var b = ADDCOLUMNS(filter(a,[All 8]>=100000),"1st c",if([1st 4Q]>0,1,0),"2nd c",if([2nd 4Q]>0,1,0))
    return DIVIDE(SUMX(b,[2nd c]),SUMX(b,[1st c]),0)

    Change the first row according to your measure names.