powerbidaxpowerquery

How to determinate inactive user in a specific period, using DAX/PowerQuery/CalculatedTable?


I have a fact and a dim table as shown below. Expected Table/DaxCode/Powerquery should answer how many & which users were active & inactive in 6/28/2025.

Fact table

    ID USER    ACTIVE USER ID    DATE        IF.ACTIVE
     -             -             6/28/2025      0 (if the user is not active, don't have any recorded value)
     -             -             6/28/2025      0
     -             -             6/28/2025      0
    123456      123456           6/28/2025      1

Dim User table

    ID USER
    -------
    123456
    234567
    345678
    456789

Expected output:

ID USER    is.Active    Date
---------------------------------
123456       1          6/28/2025 
234567       0          6/28/2025 
345678       0          6/28/2025 
456789       0          6/28/2025 

Solution

  • Here is one strategy you can follow :

    DimDate = SUMMARIZE('FactTable','FactTable'[DATE])
    
    Cross = 1
    
    is.Active = IF(
                    ISBLANK(CALCULATE(MAX('FactTable'[IF.ACTIVE])
                              ,'FactTable'[DATE]=MAX('DimDate'[Date])
                              ,'FactTable'[ID USER]=MAX('DimTable'[ID USER])
                                )
                           )
                  ,0
                  ,1
                  )
    

    You should get the desired result.