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
Anonymous
Not applicable

Issue with page level interactions - formula help

I have a lookuptable called 'Users' with UserID and user name and dateActivated . I have another table ('loginactivity') that has userID and userLogins and date. They are connected via userID and a calendar table.

I want to make a graph of the count of user logins with the x-axis being date. I also want another visual with a list of UserId and UserName so when you click on the graph, it will filter to show only userIDs that logged in.

 

If I use the formula Calculate(count('loginactivity' [userId]), 'loginactivity' [action]="Login") to calculate the graph rows AND I have another matrix table with a list of 'Users'[userID], when I click on the graph, the matrix table doesn't filter. How should I change my formula to enable the matrix to filter?

 

 

 

2 ACCEPTED SOLUTIONS

In that case, simply add just the logins count measure to the filter on the matrix table.

 

Login count measure:

Logins = CALCULATE(COUNT(User_Login[UserID]), FILTER(User_Login, [Action] = "Login"))

 

Login measure on the matrix filter list and set to is not blank:

sample9.png

 

And a date selected on the graph that is filtering the matrix to just those users that had a login on that day:

sample10.png

 

View solution in original post

Just to make sure I understanding correctly, you want a DISTINCT user count?

 

If you create a measure using the distinct count on the UserID column on the User_Login table you can actually put the AppVersion and count of users in a matrix and not require any further actions to filter.

 

Count of Users = CALCULATE(DISTINCTCOUNT(User_Login[UserID]), FILTER(User_Login, [Action] = "Login"))

 

Sample1.png

Let me know if that answers the question. 

 

View solution in original post

9 REPLIES 9
RMB
Resolver II
Resolver II

Create a new measure that checks if UserID on the logins table is filtered, if it is, then return the count measure you created otherwise return 1. Now on the filters for the matrix visual add that newly created measure and set it to is not blank. 

 

Also worth noting that the graph should be filtering the matrix if the graph is using any columns from the UserID table.

 

 

 

Table Filter = IF(ISFILTERED(User_Login[UserID]), [Logins], 1)

 

 

 

 

sample7.png

 

Sample of a user selected on the graphSample of a user selected on the graph

 

Anonymous
Not applicable

@RMB what you gave me did the opposite of what I was looking for, I want to be able to click the graph and filter the userID matrix. Your solution lets me filter the graph when I click on the UserId matrix. Can you please advise how I would do the opposite? I am inclined to think this is a formula issue but I am unfamiliar with what to do 

 

What is your axis on the graph? The above is only necessary if you're graphing with an axis from the login activity table. Do you have a sample screenshot you could share?

 

Anonymous
Not applicable

@RMB my axis is date from a calendar table (also a shared table) 

 

In that case, simply add just the logins count measure to the filter on the matrix table.

 

Login count measure:

Logins = CALCULATE(COUNT(User_Login[UserID]), FILTER(User_Login, [Action] = "Login"))

 

Login measure on the matrix filter list and set to is not blank:

sample9.png

 

And a date selected on the graph that is filtering the matrix to just those users that had a login on that day:

sample10.png

 

Anonymous
Not applicable

@RMB that worked like a dream. Could I ask you about another one? Your help would be GREATLY appreciated.

 

I want to create another matrix that is filtered BY clicking the same exact graph of user login activity that looks like this:

AppVersionCount of Users
1.312
1.414

(So that when you click the bar graph, the count of users will change based on how many users logged in with that app version at that time) 

 

I have the same 2 tables: 

Logins - but this time, there is a new column with an app version id with each login instance. So the table looks like this

UserIDLoginActivityDateAppVersion
1Login2/12/20201.4
1Login2/13/20201.4
2Login2/12/2020 1.3

 

I also have a users table with a unique list of userIDs


Again, my graph login count measure is from the Logins table and is Logins = CALCULATE(COUNT(User_Login[UserID]), FILTER(User_Login, [Action] = "Login"))

 

But I need to use App version from the Logins table BUT UserID from the Users table in the matrix 

 

Does this make sense? 

 

 

Just to make sure I understanding correctly, you want a DISTINCT user count?

 

If you create a measure using the distinct count on the UserID column on the User_Login table you can actually put the AppVersion and count of users in a matrix and not require any further actions to filter.

 

Count of Users = CALCULATE(DISTINCTCOUNT(User_Login[UserID]), FILTER(User_Login, [Action] = "Login"))

 

Sample1.png

Let me know if that answers the question. 

 

Greg_Deckler
Super User
Super User

For the first one, you should just be able to use something like COUNTROWS(RELATEDTABLE(...

 

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

 


@ 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...
Anonymous
Not applicable

Can you unpack the formula for me in greater detail please? @Greg_Deckler 

 

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.