Forum Discussion

smather's avatar
smather
Icon for Helper III rankHelper III
5 years ago
Solved

Targets Disappear When Changing Quarters

Hey all

 

hopefully someone can help. So I have a measure to work out the targets, and a filter on the visual for the measure -- so it only calcuates if the title contains turnover -- and the measure is: 

 

TargetValue =
VAR WholeYear = CALCULATE(SUM(goals[Target £]), ALL(DimDate[Month]))
VAR YearFraction = COUNTROWS(VALUES(DimDate[Month]))/12
RETURN WholeYear * YearFraction
 
Which works great (all months & qtrs selected):

 

 
 
Now, when I click Qtr 1 only: 

 

 
 
The target amount adjusts. But if I click Q2-Q4, it just has a little freak: 

 
 
 
If I filter by months, everything is fine, which leads me to believe my VAR is off -- but I'm not too sure the best way to fix it? Any help would be fab 🙂 
 
 
  • Hi smather ,

     

    Belive that the issue is based on the filtering you are doing instead of using VALUES for the YearFraction have you tried the SELECTEDVALUES?

     

    If this does not work 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.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi smather ,

    Could you please provide the calculation logic of TargetValue and some original data in your model in order to make troubleshooting? Did you create any relationship between DimDate and goals table? And how did you set your visual(Fields pane setting)? It is better if you can provide your sample pbix file(exclude sensitive data).Thank you.

    In addition, you can review the method in the following link, hope it can help you.

    Use IsInScope to get the right hierarchy level in DAX

    Best Regards

  • Hi smather ,

     

    Belive that the issue is based on the filtering you are doing instead of using VALUES for the YearFraction have you tried the SELECTEDVALUES?

     

    If this does not work 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.