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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Praj
Helper I
Helper I

Incorrect % value from DAX formula when used with Slicer

Hi Everyone, 

 

I have been stuck in a issue where I am receiving incorrect values based on my formula(I know I might have written incorrect formula) 

I have tow tables as below

Table 1: Raw - Which gives information about user and Director for each user

Praj_0-1680771829347.png

 

Table 2: Information about user, kind of event user had and data of event

Praj_1-1680771887883.png

 

Overall under Raw table, I have 15 users, out of which 9 are under Director 1 and 6 are under Director 2

 

I am trying to create below timeline slicer to check % of users who had an event during a specific timeframe and I am using a slicer to filter based on the director as shown below and I am using below DAX formula to calculate the % of users with events

% of user with actions = DIVIDE(CALCULATE(DISTINCTCOUNT(Test[User])),CALCULATE(DISTINCTCOUNT(Raw[User]),ALL(Test)))

 

Praj_2-1680772144448.png

 

To issue here I am facing is, When I choose, Dir 1 in slicer and a specific timeframe, There are 6 users who had events under Dir 1
The percentage value I am expecting is 6/9(66.6%) where 9 is the total number of users under Dir 1 however, I am getting 40%(6/15) the formula is taking all users in denominator instead of users only under Dir 1.

I know there is some issues with my formula and checked few resources with no luck. Anyone who had this issue here or any possible solution for the problem please let me know the approach.

 

Thanks in advance.

 

Cheers,

Praj

1 ACCEPTED SOLUTION
Wilson_
Super User
Super User

Hello Praj,

 

Can you try the below? What I did was instead of unfiltering the whole Test table, I'm unfiltering only the User field. (I also removed what I think is an unnecessary CALCULATE and moved the denominator into a variable for ease of reading.)

 

% of user with actions = 
VAR AllUsers =
CALCULATE (
    DISTINCTCOUNT ( Raw[User] ),
    ALL ( Test[User] )
)

RETURN
DIVIDE ( 
    DISTINCTCOUNT ( Test[User] ),
    AllUsers
)

 I've made some assumptions about the data model and your visual so if the above doesn't work for you, please provide a pbix. It would help me tremendously. 😄


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Praj
Helper I
Helper I

Thanks @Wilson_  for this. It worked for me.!

Wilson_
Super User
Super User

Hello Praj,

 

Can you try the below? What I did was instead of unfiltering the whole Test table, I'm unfiltering only the User field. (I also removed what I think is an unnecessary CALCULATE and moved the denominator into a variable for ease of reading.)

 

% of user with actions = 
VAR AllUsers =
CALCULATE (
    DISTINCTCOUNT ( Raw[User] ),
    ALL ( Test[User] )
)

RETURN
DIVIDE ( 
    DISTINCTCOUNT ( Test[User] ),
    AllUsers
)

 I've made some assumptions about the data model and your visual so if the above doesn't work for you, please provide a pbix. It would help me tremendously. 😄


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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