Forum Discussion

kchojnowski's avatar
kchojnowski
Frequent Visitor
7 years ago
Solved

Direct query - relationship with multiple columns

Hi, DQ - connection with SQL Server I have slicer with calendar. Need to make relationship with table, which has one status column and two date columns: date activation and date deactivation. They ...
  • v-yulgu-msft's avatar
    7 years ago

    Hi kchojnowski,

     

    You could create below measures:

    count for activation =
    CALCULATE (
        COUNT ( StatusTable[Date Activation] ),
        FILTER (
            ALL ( StatusTable ),
            StatusTable[Date Activation] = SELECTEDVALUE ( DateTable[Dates] )
        )
    )
    
    count for deactivation =
    CALCULATE (
        COUNT ( StatusTable[Date deactivation] ),
        FILTER (
            ALL ( StatusTable ),
            StatusTable[Date deactivation] = SELECTEDVALUE ( DateTable[Dates] )
        )
    )

     

    Add DateTable[Dates] and above two measures into a table visual.

     

    Best regards,

    Yuliana Gu

  • kchojnowski's avatar
    kchojnowski
    7 years ago

    Thanks for reply! I have made something like this and it worked:

    CALCULATE(COUNT(<table[columnname]>),USERELATIONSHIP(table[mydate];calendar[date]))

    Ofc before i have made relationship between date activation - calendard date and inactive relationship between date closed and calendar date :)