Forum Discussion
Incorrect total
Hi dannyboy123 ,
The question on this is that you are using the IF statement and HASONEVALUE this means that at the week level you only have one week so it picks up the correct value however when you look at the total level you have more than one week because the context changes so instead of doing the SUMX with the filtering it only applies the first calculation and sums all of the values for all the weeks.
Looking at your code it's seems to be that something is not quite right also because your if statment is SELECTEDVALUE(Data[Year]) you are no doing any comparision or anything else you are just getting the value for the YEAR what is that you want to achieve?
This measure may be changed to get the correct SUM at the total level but I'm not understanding the example and the code.
I have data for some of 2024 weeks and some of 2025 weeks, with a crossover of the two since week 37
If I don't check the code using hasonevalue, I end up with a lot of empty cells for either one year or the other. I only want to display those where there is a comparison to be made
- MFelix1 year agoSuper User
Hi dannyboy123 ,
I have tried to do a mockup but the measures are not working has you show it on the images.
Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.