Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

userelationship error

EnvironmentSatisfaction =
    CALCULATE(
    MAX(FactPerformanceRating[EnvironmentSatisfaction]),
    USERELATIONSHIP(DimSatisfiedLevel[SatisfactionID],FactPerformanceRating[EnvironmentSatisfaction]))
This is an HR analytics project. I always get the same result as shown in the above chart (just constant line) when trying to visualize environment satisfaction or any other field with date from dates table.
I need help with this please!

5 Replies

  • Hi, Anonymous 

    According to your dax code , you use the DimSatisfiedLevel[SatisfactionID] to FactPerformanceRating[EnvironmentSatisfaction].

    This means when you put the DimSatisfiedLevel[SatisfactionID] as a slicer , it will filter the FactPerformanceRating Table.

    But in your visual , you use the Year as a dimension (like a slicer) and it returns the same value every year.

    First , this dax adding here , it calcualtes the max of the FactPerformanceRating[EnvironmentSatisfaction] every year just related to the 'Table'[Year] and it will not be filtered by the DimSatisfiedLevel[SatisfactionID].

    You need to check if current visual has some filter on this page or you put the right field as a dimension.You can also convert this visual to a table visual to see the actual value have got to explore this issue.

     

     

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      It doesn't seem to be working. 

      Kindly check this link, this is the project and tell me if there is any thing I could do about this error.

      Thanks in advance

      HR_ANALYTICS_PROJECT.pbix

      • v-yueyunzh-msft's avatar
        v-yueyunzh-msft
        Community Support

        Hi, Anonymous 

        Thanks for your quick response and you .pbix file .

        I download it and see the dax now you used , i think this return the right.

        You put the 'DimDate'[Year] on the visual  and use the MAX(FactPerformanceRating[JobSatisfaction]) to get the max of the JobSatisfaction per year.

        And in your sample data , it seems to the max of the JobSatisfaction is the same in the each year . And it equals 5:(Such as : in 2013 year ,  the max of the JobSatisfaction =5 ;in 2014 year ,  the max of the JobSatisfaction =5)

         

        Just in the other filter context , it will return the different value .

        So the value it returns is the right logic , you need to check what the really result you need . 

         

        Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

         

        Best Regards,

        Aniya Zhang

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