Forum Discussion

CarlsBerg999's avatar
CarlsBerg999
Icon for Helper V rankHelper V
3 years ago
Solved

applying date filters to a calculated table (subset)

Hi,   My table looks like the following: Transaction ID Account ID Attribute mod. Value € Value 70345 320664 Lost 4 200,00 25/08/2022 70345 320664 New  4...
  • Greg_Deckler's avatar
    3 years ago

    CarlsBerg999 I would do it this way, PBIX is attached below signature.

    Measure = 
        VAR __Date = MAX('Dates'[Date])
        VAR __BeginDate = DATE(YEAR(__Date),1,1)
        VAR __Table = FILTER(ALL('Table'),[Value]>=__BeginDate && [Value]<=__Date)
        VAR __LostIDs = DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Attribute mod.] = "Lost"),"__TransactionID",[Transaction ID]))
        VAR __OtherIDs = DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Attribute mod.] = "Conference" || [Attribute mod.] = "Sourced" || [Attribute mod.] = "Called"),"__TransactionID",[Transaction ID]))
        VAR __Result = COUNTROWS(EXCEPT(__LostIDs, __otherIDs))
    RETURN
        __Result