Forum Discussion

DebbieE's avatar
DebbieE
Icon for Community Champion rankCommunity Champion
4 years ago

Measure Not Working using business Key (Looks like the relationships aren't there but they are)

I am looking into an issue for someone who has an excel source and has created a data model in Power BI (Star Schema)

 

Renumeration Metrics and Dim were in the same table but in Power BI we split out the data. Added a column to get the Average Salary Grouping. Created a Key. then moved that key into the metrics table. Then deleted the text items in the fact table that allowed us to merge the Key into the fact table.

 

There are only a few rows in the renumeration dim

 

And we have a base measure

Number of Employees = CALCULATE(DISTINCTCOUNT('Renumeration Metrics'[EmployeeNumber]))
And another measure over this one
Number of Employees Who Left = CALCULATE([Number of Employees], Feedback[Attrition]= "Yes")
 
And created a visual for the number of Employees who have left by the average salary grouping
 
To me, it looked like it does when the model isnt connected correctly. But the model seems to be fine.
If you had the keys from the tables it sorts itsself out but I dont want to do that obviously
 
Can anyone shed any light on this. I am fully blocked on this one. 

3 Replies

  • DebbieE's avatar
    DebbieE
    Icon for Community Champion rankCommunity Champion

    I found it. It doesnt look like the renumeration dim was created properly when it was split from the metrics. It hasnt been deduped so I can go back to power Query editor and get that fixed

    • Pragati11's avatar
      Pragati11
      Icon for Super User rankSuper User

      Hi DebbieE ,

       

      Was just about to reply to your post. Let me know how it goes. I am quite interested in knowing what went wrong and how it got fixed. 🙂

       

      Thanks,

      Pragati

      • DebbieE's avatar
        DebbieE
        Icon for Community Champion rankCommunity Champion

        What had happened I think is that the Renumeration dim was split off from the Renumeration Fact data and then a few more data items were added along the way and this table should have been made distinct with only a few rows in it.

         

        Because of the changes the Distinct rows hadnt been done so it had everything in it. Which meant the join wasnt working properly.

         

        We went it, Reset the Distinct Rows. then created the Key, then Merged the Key into the Fact table using a concatenated list of strings from the dim table we had left in the fact. Then removed the string columns from the fact table. And the problem was sorted.

         

        I really dont like creating models in Power BI because of all this. I much prefer doing them in a source database which avoids that kind of complexity. Glad we spotted it