Forum Discussion

Reine's avatar
Reine
Icon for Helper IV rankHelper IV
2 years ago
Solved

How to count when data is in more than one row

Hi - I'm trying to get a count of how many "bills" have certain combinations of codes billed on the same visit, but I cannot figure out how to get a count when the data is in more than one row.  See ...
  • HotChilli's avatar
    2 years ago

    Thank you for the prompt, I had not forgotten about you.
    This is a measure.

    TestNoOf92004_92015 = 
    var _04 = CALCULATETABLE(TableX,  TableX[Code] = 92004) 
    var _sel04 = SELECTCOLUMNS(_04, "Bills",  TableX[BillID])
    
    var _15 = CALCULATETABLE(TableX,  TableX[Code] = 92015) 
    var _sel15 = SELECTCOLUMNS(_15, "Bills", TableX[BillID])
    RETURN
    COUNTROWS(INTERSECT(_sel04, _sel15))

    Let me know how you get on