Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Sohan
Helper III
Helper III

Data changing when adding legend

I have the following bar chart:

Sohan_0-1626950157683.png

 

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

Sohan_1-1626950224739.png

 

Does anyone know why this happens?

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

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:

MFelix_0-1627377240635.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
MFelix
Super User
Super User

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:

MFelix_0-1627377240635.png

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



amitchandak
Super User
Super User

@Sohan , depend on measure and legend used and relationship

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak please find a sample pbix file here: pbix file 

Hey @Sohan ,

 

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:

selimovd_0-1626977070863.png

 

And the second visual:

selimovd_1-1626977084565.png

 

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
 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.