Forum Discussion

powerbiuserrbt's avatar
powerbiuserrbt
New Member
2 years ago
Solved

Display All Users with Activity Data (Including Zeros)

I'm working on a Power BI report where I need to show activity data for all users, even those who have zero activity within a selected date range.   Here’s what I’m trying to achieve: Include All ...
  • Rupak_bi's avatar
    2 years ago

    Hi, if you just want to see the names have zero count you can simply use below syntax to create a measure.

    Count= max(0,calculate(sum(table, activity count))).

    This will bring all the names and dates

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi All
    Firstly  Rupak_bi thank you for your solution!
    And powerbiuserrbt , I think the key point of your requirement is to ensure that all users are shown their activity regardless of whether they are active in the selected date range or not, hopefully my answer addresses your question!

    Measure 2 = 
    VAR SelectedStartDate = MIN('Data Table'[Date])
    VAR SelectedEndDate = MAX('Data Table'[Date])
    RETURN
    MAXX(
       ADDCOLUMNS(
           ALL('Table'[User]), 
           "ActivityCount",
           CALCULATE(
               SUM('Table'[ActivityCount]),
               'Table'[ActivityDate] >= SelectedStartDate &&
               'Table'[ActivityDate] <= SelectedEndDate,
               TREATAS(VALUES('Table'[User]), 'Table'[User]) 
           )
       ),
       COALESCE([ActivityCount], 0) 

    If you have any other questions, check out the PBIX file I uploaded and I would be honoured if I could solve your problem!

    Hope it helps!

     

    Best regards,
    Community Support Team_ Tom Shen

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.