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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
pranit828
Community Champion
Community Champion

Calculate Allexcept to neglect only few slicers

Hi All,

I have the below table and slicer on columns Tabl[Cl], Tabl[Qu] and Tabl[Op]

 

Cl Qu Op Sn
A A1 O1 1
A A2 O2 2
A A3 O3 3
B B2 O2 4
B B3 O3 5
C C3 O3 6
C C4 O4 7

pranit828_1-1616523888089.png

When I don't select Tabl[Op] slicer I get the count as 3 from the below measure.

 

Tot = CALCULATE(COUNT(Test_tbl[Sn]),ALLEXCEPT(Test_tbl,Test_tbl[Cl],Test_tbl[Qu]))
OR
Tot = CALCULATE(COUNT(Test_tbl[Sn]),ALLSELECTED(Test_tbl[Cl],Test_tbl[Qu]))

 

What I need is to count the total rows independent of the selection in [Op] and dependent on the selection in [Cl] and [Qu].

So, It should always return 3 if I change only the selection in [Op] slicer in the above screenshot.

 

The sample file is attached at the bottom.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
2 ACCEPTED SOLUTIONS
AlbertoFerrari
Most Valuable Professional
Most Valuable Professional

Hi,

I did not check the details, but it looks to me that this is nothing but the auto-exist behavior described here: Understanding DAX Auto-Exist - SQLBI
Give it a look, try a star schema and LMK if it works. 
Best and... enjoy DAX! 🙂

Alberto Ferrari - SQLBI

View solution in original post

marcorusso
Most Valuable Professional
Most Valuable Professional

It's the side effect of combining SUMMARIZECOLUMNS with auto-exists
Long story short: use a star-schema.

View solution in original post

5 REPLIES 5
AlbertoFerrari
Most Valuable Professional
Most Valuable Professional

Hi,

I did not check the details, but it looks to me that this is nothing but the auto-exist behavior described here: Understanding DAX Auto-Exist - SQLBI
Give it a look, try a star schema and LMK if it works. 
Best and... enjoy DAX! 🙂

Alberto Ferrari - SQLBI
selimovd
Super User
Super User

Hey @pranit828 ,

 

that behavior is for me super strange.

I tried a basic version:

Tot_New = CALCULATE( COUNTROWS( Test_tbl ), ALL( Test_tbl[Op] ) )

 

But for some reason the ALL( Test_tbl[OP]) is totally ignored. There is also no sort by column what would explain that.

The following query is sent when I use the slicer of Test_tbl[Op]:

6.png

 

I have no idea why this happened.

Maybe that's a case for @marcorusso and @AlbertoFerrari ?

 
Best regards
Denis
 
 
marcorusso
Most Valuable Professional
Most Valuable Professional

It's the side effect of combining SUMMARIZECOLUMNS with auto-exists
Long story short: use a star-schema.

AlbertoFerrari
Most Valuable Professional
Most Valuable Professional

🙂 This is what happens when they summon us both 

Alberto Ferrari - SQLBI

@AlbertoFerrari  @marcorusso 

Sorry about that, next time I will just mark one of you and the time afterwards the other 😉

Didn't know about Auto-Exists, very interesting topic! Every day in DAX I learn something new 😅

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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