Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Need help in DAX, Distinct Count

Hi, I am trying to calculate distinct count for Supplier ID based on Member ID, but it's not working the I want, please find DAX below DistinctSupplierID = var __member = T[MemberID] var __endDat...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    Anonymous , OK, you want this:

     

    Column = 
    var __endDate = T[ReportReceived].[Date]
    var __startDate = EDATE( __endDate, -6)
    RETURN
        COUNTROWS(
            DISTINCT(
                SELECTCOLUMNS(
                    FILTER(
                        'T',
                        [MemberID] = EARLIER([MemberID]) &&
                            T[ReportReceived].[Date] <= __endDate &&
                                T[ReportReceived].[Date] >= __startDate
                    ),
                    "SupplierID",[SupplierID]
                )
            )
        )