Forum Discussion

Thorsten_P's avatar
Thorsten_P
Regular Visitor
2 years ago
Solved

Zero Value in Tables

We were given a small task that we couldn't solve well. Maybe one of you already had this problem and was able to solve it?

 

I have a file with employees that contains the columns "Name" and "Employee-Number".

In another file I have a list of transactions, which has the columns "Employee-Number", "Activity type", "Activity date".

I would like to display a list of all employees in Power BI, regardless of whether the employee had an activity on a particular day.

 

Example for file 1
Employee A - 12345
Employee B - 12346
Employee C - 12347

 

Example for file 2
Employee A - Activity type 1 - 06/14/2024
Employee B - Activity type 1 - 06/14/2024
Employee B - Activity type 1 - 06/14/2024

 

Output in Power BI:

If I filter the date 06/14/2024, the result should look like this in a table:

 

Activity type 1 - Employee A - Number 1
Activity type 1- Employee B - Number 2
Activity type 1 - employee C - number 0

 

How do I get employee C (who did not have an activity on 06/14/2024) to be displayed as a "zero value"?

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Thorsten_P ,

    Thank you djurecic very much for the solution, , to help you understand the problem, I also tried some other ways to solve the problem:

    number = 
    IF(
                COUNTROWS(
                FILTER('Table (2)',SELECTEDVALUE('Table'[User])='Table (2)'[User]
                )
                )=0,
                0,
            COUNTROWS(
                FILTER('Table (2)',SELECTEDVALUE('Table'[User])='Table (2)'[User]
            )
    ))

    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.

2 Replies