Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello PBI/DAX experts!
(This is my first post so please go easy. After seeing what good and bad posts look like I was intentional about including pictures and the DAX of what I'm doing, but please let me know what else may be helpful. I've been a consumer of the PBI community for a couple years now and have benefited greatly from its content, so thank you! Maybe I can contribute with a scenario of my own that may benefit another.)
I'm having difficulty figuring out why my ALL and ALLEXCEPT measures are producing unintended results when selecting more than 1 filter/slicer on my report. Below is a "Filters Menu" that contains multiple slicers that users can choose from when interacting with the report. The visual on the right is a simple table visual to display my measures. Here is the DAX code of each from left to right and they are from 1 single table in my PBI model:
1) My numerator: Providers = DISTINCTCOUNT ( 'EncounterFact'[Encounters.ProviderID] )
2) Numerator & Denominator (same result with both denominators below):
% Providers = EncounterFact[Providers] / EncounterFact[Providers (ALLEXCEPT)]
3) Denominator (ALL):
Providers (ALL) =
Both "Providers (ALL)" and "Providers (ALLEXCEPT)" are supposed to be doing the same thing, I just wanted to compare the two in case I was doing something incorrect with one or the other. The first picture shows the results when no filters/slicers are applied, which is correct. The second picture shows results when 1 filter is applied, which is correct. The third picture produces strange results when a second filter/slicer is applied. In the 3rd picture the "Providers" measure is correct at 183. However, both the ALL and ALLEXCEPT denominator measures are producing 1,384 when it should be 1,403. The "% Providers" should read 13.0% (183/1,403). For some reason I'm getting these unintended results when multiple slicers are applied even though I've specified to either ignore those columns in the table that are the slicers/filters in the menu (ALL), or I've called out the columns to accept (ALLEXCEPT).
Could someone please explain to me what I'm missing here? I want users to interact with these slicers and have them affect the table visual and those measures, just want most of them to ignore the denominator and not produce strange results if more than 1 slicer is applied.
Thanks so much!
Before:
After 1 Filter/Slicer Applied
After 2 Filters/Slicers Applied
@Anonymous, thanks so much for your feedback. I have a decent understanding of the difference you are describing between ALL and ALLEXCEPT if I were to have more than 1 table in my datamodel. In my case it's an extremely simple model, in that I have just 1 table in it: EncounterFact.
I did notice that if I remove my column EncounterFact.EncounterDate from the "Filters" pane that is being used under "Filters on all pages" that the ALL and ALLEXCEPT measures correct themselves and no longer show an unintended result. Now I'm able to use multiple visual slicers together in various combinations and it won't change it. But if I try to change the date range slicer that is using EncounterFact.EncounterDate, then I get those unintended results again.
I think somehow my measure needs to preserve that EncounterFact.EncounterDate column used in my "Filters" pane AFTER the DAX measure calculates so it reapplies that date filter back on the measure. This way it persists regardless of what combination of filters the user selects on the Filters Menu UNLESS they specifically change the date range on the "Visit Date" slicer, which is using the EncounterFact.EncounterDate column. Here is a picture below for a visual. Again, I'd like to keep the applied filter on the "Filters" pane and only override when a user changes that date range, all while ignoring the other slicers/columns used in the "Filters Menu."
Does this make more sense of what I'm trying to accomplish? Please let me know if you need anything else. I really appreciate your help!
@Anonymous , refer if these can help
https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/
@amitchandak, thanks so much for the response. I tried these solutions, but they don't appear to address my issue. I'm still getting unintended results. Any other ideas?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
32 | |
30 | |
18 | |
18 |