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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
avtle
Frequent Visitor

ALLEXCEPT Overwrites Relationships

Background: I have three tables: 1) Time Selection 2) Month 3) FactTable. I'm using Time Selection to filter down the Month table so that the user can dynamically filter between Calendar Years and Fiscal Years.

 

Sample database link

 

Issue: I'm trying to calcuate a yearly total that is dynamic between Calendar and Fiscal Years. My initial formula for this is:

Values Sum: Yearly = CALCULATE([Values Sum], ALLEXCEPT('Year Selection', 'Year Selection'[Year], 'Year Selection'[Time Period]))
The issue arises when attempting to view this measure using fields from the Month table (such as quarter). When the above measure is added to a visual, all filtering from the Year Selection table is ignored. This results in the value being repeated for each line as if there is not a relationship between Year Selection and Month. 

 

Is there a way to calculate a Yearly total in this situation while still maintaining the relationship between tables?

 

Sample database link

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @avtle ,

Allexcept() removes all context filters in the table except filters that are applied to the specified columns, the year should naturally be start from 2017 to 2020 in your visual.

When you apply the slicer,,for example 2020 the sum will show the corresponed value, other year values are blank and the yearly sum will always show from 2017 to 2020.

Use if statement is a alternative workaround, but if you think it is inefficient, you can use the visual filter to set the sum value is not blank to get the same result.

visual filter.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

6 REPLIES 6
mahoneypat
Microsoft Employee
Microsoft Employee

The Year column from the Year Selection table is not used in your visual.  Is that correct?  To remove the filters from the Year and Quarter columns used in the visual, you can use this expression.

 

Values Sum: Yearly = CALCULATE([Values Sum], ALL('Month'[Month], 'Month'[Quarter]))
 
If not, please describe your desired functionality/outcome.
 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hi @mahoneypat, thanks for the response.

 

The Year column is not used, but I would like to use this measure in other scenarios to show the yearly sum.

 

I have created a work around function:

var x = ISBLANK(MIN('Year Selection'[Year Month]))
return
IF(x,BLANK(),CALCULATE([Values Sum], ALLEXCEPT('Year Selection', 'Year Selection'[Year], 'Year Selection'[Time Period])))
 
This seems to eliminate the interaction between tables issue, however it seems inefficient to use an if statment.
 
Am I fundamentaly missing something with ALLEXCEPT?

Chart with new function (this is graphically what I was expecting):
Capture.PNG
v-yingjl
Community Support
Community Support

Hi @avtle ,

Allexcept() removes all context filters in the table except filters that are applied to the specified columns, the year should naturally be start from 2017 to 2020 in your visual.

When you apply the slicer,,for example 2020 the sum will show the corresponed value, other year values are blank and the yearly sum will always show from 2017 to 2020.

Use if statement is a alternative workaround, but if you think it is inefficient, you can use the visual filter to set the sum value is not blank to get the same result.

visual filter.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

mahoneypat
Microsoft Employee
Microsoft Employee

Using an IF is fine if the result is performant for your application.  If you see sluggish response with slicer selections, you can evaluate alternatives.  Now that I see your two charts, I get more of what you are trying to do.  I think it would be simpler to have a Date table that also has a Fiscal Year column in it that you can use in the slicer.  I think this video might be helpful.

https://www.youtube.com/watch?v=1-agbCF7HwY

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @avtle

Please check as per your requirement

https://www.youtube.com/watch?v=r1AbCsKwzzs

Hi @Anonymous,

 

Thanks for your response. The video does not seem to address the concern I have here. I tried both the ALLSELECTED and SUMX solutions he presented.

 

Baseline, I am looking to trim this chart so that the axis is still filtered by the axis when the yearly total is added.

 

Chart without yearly total (filters working properly):

avtle_1-1597783379611.png

 

 

Chart with yearly total (filters not working properly):

avtle_0-1597783294044.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.