Forum Discussion
Filter table by selected client's region
- 6 years ago
Hi Anonymous
This expression is ignoring filter applied to 'Clients'[ClientCode] only, all other filters on attributes within the 'Clients' dimension are preserved.
- replying filters by VALUES ( 'Clients'[Region] ) is not necessary, as this filter was not ignored by ALL( 'Clients'[ClientCode] )
- adding any other attribute from the 'Clients' dimension, for example, 'Clients'[City] would add it to filter context and result in every 'Clients'[ClientCode] duplicating SUM( Sales[Orders] ) value for this City.
- To ensure the above is not happening you need to ignore all filters coming to form Clients Dimension and apart from the 'Clients'[Region].
CALCULATE ( SUM ( Sales[Orders] ); ALL ( 'Clients'[ClientCode] ); VALUES ( 'Clients'[Region] ) )In reference to the workshop that you have been attending, this is true and you should do it whenever possible or logical, it brings most benefits when you preforming iterations.
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Hi Anonymous
Try removing filters from all 'Clients'
CALCULATE (
SUM ( Sales[Orders] );
ALL ( 'Clients' );
VALUES ( 'Clients'[Region] )
)
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Hi Mariusz,
Thank you so much, that worked wonders!
However, could you explain a little bit why it works, please? I have heard in some DAX workshops that you should not filter full tables, but instead only the columns you intend to use. Is your answer an exception to this?
Thanks again!
Alex
- Mariusz6 years ago
Community Champion
Hi Anonymous
This expression is ignoring filter applied to 'Clients'[ClientCode] only, all other filters on attributes within the 'Clients' dimension are preserved.
- replying filters by VALUES ( 'Clients'[Region] ) is not necessary, as this filter was not ignored by ALL( 'Clients'[ClientCode] )
- adding any other attribute from the 'Clients' dimension, for example, 'Clients'[City] would add it to filter context and result in every 'Clients'[ClientCode] duplicating SUM( Sales[Orders] ) value for this City.
- To ensure the above is not happening you need to ignore all filters coming to form Clients Dimension and apart from the 'Clients'[Region].
CALCULATE ( SUM ( Sales[Orders] ); ALL ( 'Clients'[ClientCode] ); VALUES ( 'Clients'[Region] ) )In reference to the workshop that you have been attending, this is true and you should do it whenever possible or logical, it brings most benefits when you preforming iterations.
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.