Forum Discussion

Grieclolu's avatar
Grieclolu
Helper I
3 years ago
Solved

One-to-one wrong filter

Hi everyone,

 

I just uploaded 2 tables:

- the first is related to the company staff ( all the staff with personal ID, for each month with a specific column)
- the second is related to the terminations, stil with personal ID and month

 

For each of them, i also perfomed a new coulum, where there is a unique code formed by the person id + the month.

 

With these tables, i settled a one-to-one relationship. 

The problem is that this relationship does not work properly, for example: if i want to see how many terminations (information present in the second table) there have been per gender (information present in the first table), PBI is not able to filter it (you cna see it in the screen below).

 

How can i handle/fix it?

 

Thanks a lot,

Luca

 

 

 

 

  • Grieclolu Right, I used your 2 tables originally, not a single employee in Gender that matches with Terminations. Check it yourself in the updated PBIX attached below signature. Gender3, Table3, Page3.

     

17 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Grieclolu Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • Grieclolu's avatar
      Grieclolu
      Helper I

      Dear Greg_Deckler ,

       

      Thank you for your answer. I try to explain better through these two tables. 
      I uploaded these two tables is PBI and i linked them throuhg a 1-1 relation (ID).

      In the report, i would like to see how many terminations i have (second table) per gender, but i doid't get the expected result (as you can see in the screen).

      Thanks in advance for your help.

      Luca

       

       

      GenderID
      Female1_1
      Female10_1
      Female1000_1
      Female10023_1
      Male1004_1
      Female10045_1
      Male10061_1
      Female10072_1
      Male10089_1
      Male10093_1
      Female10098_1
      Female10110_1
      Female10118_1
      Female10126_1
      Female10128_1
      Male10137_1
      Female10138_1
      Female10140_1
      Female1015_1

       

      ClusterID
      Voluntary1008_1
      Involuntary10089_2
      Voluntary10092_1
      End of contract10118_2
      Voluntary10137_6
      Voluntary10165_7
      Voluntary10239_8
      Involuntary10244_8
      Voluntary1030_4
      Voluntary10332_3
      Involuntary10360_3
      Voluntary10389_4
      Voluntary1040_2
      Voluntary10421_3
      Involuntary10445_1
      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Grieclolu OK, so you are getting blanks (unmatched employees) in your visual and you don't want that. So, try creating these measures and put them in your Values instead of Count of ID from you second table. 

        Male Terminations =
          COUNTROWS(
            FILTER(
              'GenderTable',
              [Gender] = "Male" &&
              [ID] IN SELECTCOLUMNS('Terminations',"__ID",[ID])
            )
          )
        
        
        
        Female Terminations =
          COUNTROWS(
            FILTER(
              'GenderTable',
              [Gender] = "Female" &&
              [ID] IN SELECTCOLUMNS('Terminations',"__ID",[ID])
            )
          )