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
ElvirBotic
Helper III
Helper III

DAX Not Responding to Slicer Selection

Hello, I have a star schema and I am trying to create a measure that will provide me the total number of users broken down by account. There are a total of 20k users and when visualized in a table by account the total number of users is the same for all accounts. Do I need to use crossfilter? selectedvalue? 

 

ElvirBotic_0-1627670647226.png

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@ElvirBotic You need to modify your cross-filter direction of your Training to Users relationship to Both.


@ 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...

View solution in original post

8 REPLIES 8
v-yangliu-msft
Community Support
Community Support

Hi  @ElvirBotic ,

What is your Dax like, can you share it?

You can create a calculated table, which contains the columns for the slicer to use.

For example:

Slice Table =
SUMMARIZE('Table','Table'[date])

 

Best Regards,

Liu Yang

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

I used the following DAX.

 

Total Users = CALCULATE(
DISTINCTCOUNT(Users[User Id]),
CROSSFILTER(Training[User Id], Users[User Id], Both)
)
Greg_Deckler
Super User
Super User

@ElvirBotic You need to modify your cross-filter direction of your Training to Users relationship to Both.


@ 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...

I see. Thank you. Is this a scenario where using bi-directional filtering is okay? I was told to stay away from it like the plague. 

@ElvirBotic Whoever told you that was smoking crack.


@ 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...

Is there a way to when using a slicer not have the "Total Users" measure not be impacted by different slicer inputs? Right now everytime I select a month or account it will also filter the table with the measure and I want it to always show a constant value. 

@ElvirBotic Sure, use ALL or ALLEXCEPT or REMOVEFILTERS for instance in your measure to obliterate the existing filter context.


@ 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...

I think I am doing something wrong.  The below DAX is still being affected by the month slicer in my model. 😞

 

Total Users = CALCULATE(
DISTINCTCOUNT(Users[User Id]),
CROSSFILTER(Training[User Id], Users[User Id], Both),
REMOVEFILTERS( 'Date'[Month] )
)

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.