Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Data changing when adding legend

I have the following bar chart:

 

When I add a legend to this chart, the values change:

 

Does anyone know why this happens?

 

  • Hi @Sohan ,

     

    Believe this is a repetion of the post below please see the same answer I have posted on the previous post

    https://community.powerbi.com/t5/Desktop/Data-changing-when-adding-legend/m-p/1978919

     

    Your data is not changing you are changing the context of your data so that is why you are getting different results.

     

    In your case you are making the distintc count of patient Number when you have the calculation at the week level a single patient is consider only once even if he appears in more than one Gebruiker.

     

    However when you add the Gebruiker the context changes and you add a different level of details so now you are picking up the same patient number once for each Gebruiker.

     

    Let's look at the example below:

     

    If you select the patient 729-8773 on week 3 you have a single patient, however it is consider in 3 different Gebruiker so when you add the legend you get a total of 3 patients:

     

     

4 Replies

  • Hi @Sohan ,

     

    Believe this is a repetion of the post below please see the same answer I have posted on the previous post

    https://community.powerbi.com/t5/Desktop/Data-changing-when-adding-legend/m-p/1978919

     

    Your data is not changing you are changing the context of your data so that is why you are getting different results.

     

    In your case you are making the distintc count of patient Number when you have the calculation at the week level a single patient is consider only once even if he appears in more than one Gebruiker.

     

    However when you add the Gebruiker the context changes and you add a different level of details so now you are picking up the same patient number once for each Gebruiker.

     

    Let's look at the example below:

     

    If you select the patient 729-8773 on week 3 you have a single patient, however it is consider in 3 different Gebruiker so when you add the legend you get a total of 3 patients:

     

     

  • Anonymous , depend on measure and legend used and relationship

     

    Can you share sample data  Or a sample pbix after removing sensitive data.

      • selimovd's avatar
        selimovd
        Most Valuable Professional

        Hey Anonymous ,

         

        it's a little tricky to say because your data model is a mess.

        First of all the visuals use different filters. Here the first visual:

         

        And the second visual:

         

        But even when they are the same, the result is still different.

        To be honest I'm pretty sure it comes from the data model. Change your data model to fact and dimensional tables and you won't have strange behavior like that.

        Start with the following article that describes the basics pretty well:

        Basics of Modeling in Power BI: Fact Tables - RADACAD

         

        If you need any help please let me know.
        If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
         
        Best regards
        Denis