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.
Hi. I have data for part of last year and part of this year. I only want to display rows where there is data for both. Hasonevalue seems to support this, because I can return blank if there are two years being filtered. Otherwise, Id have two columns, both with largely empty values in one of them. The only weeks I have data for both are weeks 37-40, so they are the only ones I want to display