Forum Discussion

az38's avatar
az38
Icon for Community Champion rankCommunity Champion
7 years ago
Solved

LEFT JOIN with multiple conditions

Hello, DAX-profies!   I have a user sessions log User session could be started at one day and finished at the other I need to match calendar days and quantity of uniques users who were active a t...
  • LivioLanzo's avatar
    7 years ago

    az38

     

    You can create a calculated table like this:

     

    LogInsModified = 
    SELECTCOLUMNS(
        GENERATE(
            LogIns,
            VAR St = INT( LogIns[Start_Session] )
            VAR En = INT( LogIns[End_Session] )
            RETURN
            CALENDAR( st, en )
        ),
    "Session_id", [Session_id],
    "User_ID", [User_id],
    "Date", [Date]
    )

     

    Then relate it to the calendar table and use this simple measure:

     

    Active Users = DISTINCTCOUNT( LogInsModified[User_ID] )