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
_lasfera
Frequent Visitor

Card visual not working with CALCUALTE(), ALLEXCEPT() and filters

Hello guys,

 

I have been struggling to understand how the measures and the card visuals do not work as expected.

The columns involved are : (1) TICKETID, (2) REPORTDATE,(3) OWNERGROUP from a table called 'MAXIMO_SR' (As shown in picture below)

 

_lasfera_1-1642790482119.png

And I have created a date slicer with MAXIMO_SR[REPORTDATE] to filter the date, a slicer with MAXIMO_SR[OWNERGROUP] to filter the group , and of course a measure called [Total Count] to count the number - COUNTROWS(MAXIMO_SR) to put on card visual, which I expect to change as I toggle either/both slicers, and it does. 

_lasfera_1-1642792548999.png

Everything looks fine until I go on to write another measure to put on a card visual to show the counts of all the events irregardless of what ownergroup the event falls into, while subjected to date slicer I created earlier , so I wrote a measure : 

 

Total Selected Service Requests =
CALCULATE(
 COUNTROWS(MAXIMO_SR),
 ALLEXCEPT(MAXIMO_SR,MAXIMO_SR[REPORTDATE])
)

 

I expect the 'Total Selected Service Requests' card visual WOULD change as I toddle the date slicer, and WOULD NOT as I do the OWNERGROUP slicer, and it kinda backfired - it turned to be no difference from the [Total Count]:

 

_lasfera_2-1642793079307.png

 

But when I wrote another measure ,as shown below, to put on card visual. It works, it would not change when I toggle the REPORTDATE slicer but would as I do the OWNGROUP slicer

 

Total OWNGROUP COUNT =
CALCULATE(
COUNTROWS(MAXIMO_SR),
ALLEXCEPT(MAXIMO_SR,MAXIMO_SR[OWNERGROUP])
)
 
I know one easy way out is to resort to the 'Edit Interactions', it won't be useful into further calculations, I am at my wits' end coming up with workable solutions, and hope my trouble is expressed clearly, much appreciation in advance!
1 ACCEPTED SOLUTION
bcdobbs
Super User
Super User

A lot of your issues are being caused by having a single table. If you create a separate date table https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/ and a table with unique OWNERGROUP (you can just use DISTINCT(ColumnName) to

create such a table you will find using REMOVEFILTERS much more predictable.

 

That said in your current setup are you currently sorting OWNERGROUP by another column? If you are then you need to remove that as well using REMOVEFILTERS (both get added to filter context)



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

5 REPLIES 5
bcdobbs
Super User
Super User

A lot of your issues are being caused by having a single table. If you create a separate date table https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/ and a table with unique OWNERGROUP (you can just use DISTINCT(ColumnName) to

create such a table you will find using REMOVEFILTERS much more predictable.

 

That said in your current setup are you currently sorting OWNERGROUP by another column? If you are then you need to remove that as well using REMOVEFILTERS (both get added to filter context)



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
v-henryk-mstf
Community Support
Community Support

Hi @_lasfera ,

 

As @lbendlin  said, you can try using the REMOVEFILTERS function, which clears the filters in a given table or column.

 

vhenrykmstf_0-1643093499741.png

You can refer to the following blogs to deepen your understanding of these functions.

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

Hi! Thanks for your reply and sorry for the late response, this doesn't seem to work as well.

 

Here's how I write the codes:

Count_Overriding_OWNERGROUPFilter =
CALCULATE(
COUNTROWS(MAXIMO_SR),
REMOVEFILTERS(MAXIMO_SR[OWNERGROUP])
)
 
and a normal one to show the contrast : 
CountEvents = COUNTROWS(MAXIMO_SR)
 
And it turns out to not override the OWNERGROUP Filter (And a bit of counting problems too), I expect the Card Visual to NOT change as I toddle the OWNERGROUP Filter
_lasfera_0-1644735193129.png

 

 

 
lbendlin
Super User
Super User

ALLEXCEPT is a very blunt instrument. You may want to consider REMOVEFILTERS instead.

Thanks for your reply, but that didn't seem to work as well, I detailed that in the reply above.

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.