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 ())
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman2
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.
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman0 -
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?
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman0 -
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"
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman0 -
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
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman1 -
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 ())
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman2 -
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 ())
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman1 -
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.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 710 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive