beast mode % calculation
I wanted to calculate % of active user using the following beast mode, but soemhow it only gives 100%. I could not figure out what went wrong.
In this exmaple, %of active user should be 2215/(2215+3273) , but it shows 100%.
This is my beast mode:
COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` end)/COUNT(DISTINCT `usersid`)
Thank you.
Olivia
Best Answer
-
You could try this:
(COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` else 'Inactive User' end)-1)/ (COUNT(DISTINCT `usersid`) over ())
2
Answers
-
I wonder if the distinct is throwing it off. Here is a beast mode that shows login failure rate that is similar to what you are trying to do. I got it from one of the cards in the DomoStats quickstart if you have that in your instance and want to compare.
(COUNT((CASE WHEN (`Action` = 'FAILED_LOGIN') THEN `Action` END ))
/ COUNT((CASE WHEN `Action` IN ('LOGGEDIN','FAILED_LOGIN') THEN `Action` END )))You might try copying this code and swap in/out the appropriate column names and values that you are looking for and see if this works for you.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
I'm not sure if the picture that you shared is the table you are using this metric in, but if it is then the issue is with how you have built the table card.
You need to remove the `useractivity_status` field from the table. As it is built now, the beastmode is being given a list of all 'Active User's first, of which 100% are active and then it is given the list of inactive users, of which 0% are active.
0 -
Hi, Superman,
I actually wanted to create a line chart to show the active user % overtime. But I got a line at 1, so I try to use table to check the data.
I do need to count(distinct) because an userid is recorded every time there is an action.
0 -
Hi, Mark, it does not work for my case because I do need to count(distinct). The userid is recorded for every action an user took. I need to remove the dublications.
0 -
Can you share the rest of the settings for that chart?
0 -
I did not set up anything in the line chart.
0 -
(COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` else 'not active' end)-1)/COUNT(DISTINCT `usersid`)
You could try something like this. The issue might be that the case statement has no where to go if the status is not "Active User"
0 -
Have you tried changing your date selector grouping? If it is set to None, that could be your issue if your date field has a time stamp in it. Try setting it to group by Month and see if your calculation works properly.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
(COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` else 'Inactive User' end)-1)/COUNT(DISTINCT `usersid`)
I changed the beast mdoe to this and also grouped date to month, but got the same chart - still 100% active users.
I thought this is an easy chart to draw
0 -
I think this has more to do with the dataset. My guess is that if you look at the events that 'occurredat' the time frame you are graphing, you will find that the users that performed actions in that time are all still active users. You need to identify a way to identify the users that don't have activities
1 -
Hi
If you were to split your beast mode would you get
Active Users:2215
Users: 2215
or
Active Users:3273
Users: 3273
The answer might give you a clue. You might find the inactive users due nto come up at all in the activity log during the peroid or something like that.
1 -
You could try this:
(COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` else 'Inactive User' end)-1)/ (COUNT(DISTINCT `usersid`) over ())
2 -
Superman,
You are genius -- It works now.
But I wanted to point out that
COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` else 'Inactive User' end) -1 reduced the active number by 1. For example, I suppose to have 127 active users, using -1, I only got 126.
Best,
Olivia
1 -
Good point. It should really be:
(COUNT(DISTINCT case when `useractivity_status` = 'Active User' then `usersid` end))/ (COUNT(DISTINCT `usersid`) over ())
1 -
Hi, Superman,
can you also help me with this -- I need to report on Active user/Inactive user by group.
I am able to report on overall active user /inactive user, but as you have figured out in the previous post, the occurred date is only associated with Active user, meaning when there is an action, there is a date recorded. Thus the inactive users are not associated with date.
theoretically, the inactive user = total user - active user for each group, is it possible to somehow to link the inactive users?
Thank you very much.
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive