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

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.

Reply
Triadelphia
Regular Visitor

Using ALLEXCEPT function corrects calculation but also affects entire visual?

I wanted to ignore a filter applied by a visual slicer for the purpose of calculating totals on a measure and used ALLEXCEPT to ignore the filter applied by the slicer for the purposes of calculating the totals to display.  The slicer filters a matrix to display only the Content IDs viewed by the selected CustomerID (s).  I wanted a Total Customer Views measure to display the Unique Customer View Count for each Content ID (a simple distinct count on CustomerID will obviously return a result of 1 if you only have one CustomerID selected in the filter).  

 

I used ALLEXCEPT to calculate the distinct total of all customer IDs that had viewed the content,  this worked to properly calculate the total number of customers that had viewed each piece of content, but the matrix now displays counts ALL content IDs, not just total customer views of the cotent that the customer ID from the slicer had viewed.  I had naively assumed that using ALLEXCEPT in a CALCULATE function only affected the numeric calulations - apparently that is not the case?   Is there an option to ignore the filter of the slicer for purposes of the calculation for total views, but only display the full totals for the content the customer ID had viewed?  Do I need to reapply the slicer filter to the result of the CALCULATE using ALLEXCEPT?  

 

Thank you for any assistance!

 

3 REPLIES 3
barend_dronkers
Regular Visitor

@Greg_Deckler I'm having the exact same problem. I am using the following code to count attendance of campaign members across ALL historical campaigns, but I want to only show the attendance in a table visual for campaigns pertaining to a specific campaign I choose using a report page slicer:

 

 

 

Member Attendance = 
var AttendanceCount = calculate(countrows('Campaign Member'), ALLEXCEPT(Campain, Campaign[Id]),'Campaign Member'[Status]="Attended")
return AttendanceCount

 

 

 

While the calculation is correct, the table I've constructed to visualize the results now ALSO ignores the Campaign ID filter (which would be activated by a slicer on my report page). This means the visual lists all campaign members, even those that aren't in the specific campaign I've filtered using a slicer on the report page
 
Campaign table (with a corresponding slicer)
Campaign ID        
Campaign Name   
AApple newsletter
BOrange newsletter
 
Campaign Member table
Name        
Campaign ID     
Status           
BobANo Show
SuzyANo Show
AmyBAttended
BobBAttended
 
My visual (Not desired because I have a slicer that should filter the visual so that only Campaign B, Orange newsletter members should show up. But the calculation results are correct. Bob only attended one event; so did Amy.):
 
Campaign Member [Name]         
Member Attendance (the measure from above)     
Bob1
Suzy0
Amy1
 
My visual (Desired. The filter on the Campaign slicer means that only Bob and Amy show up in the table visual. AND the Member Attendance measure still counts attendance as if the Campaign ID filter is ignored):
 
Campaign Member [Name]        
Member Attendance (the measure from above)     
Bob1
Amy1
 
Solutions?
Triadelphia
Regular Visitor

Gregg - I can try to replicate some of the item, but I can't post the actual data.  There are no blank values in terms of Content ID with no customer views, all of the results returned have a count of 1 or more.  I was surprised by the behavior, as I assumed that the CALCULATE using ALLEXCEPT against the filter column would affect only the calculation values, versus ignore the filter entirely.  

Greg_Deckler
Super User
Super User

@Triadelphia So, this can happen. Table and matrix visualizations automatically filter out rows where all of the numeric calculations return BLANK. So, probably something you can do to your measure to return BLANK instead of a number based upon some condition. However, next to impossible to say what that something is with the given information.

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.