Forum Discussion
Summarize the Measure output
- 1 year agoIt is creating a measure that will use your existing measure on your table 'public dailyusagereport' to work out how many logins each person has and then group them.Replace LoginTable with the name of your table like so:Count Logins=var logintable = --Create a virtual version of your table, calc for each person their login noSUMMARIZE('public dailyusagereport','public dailyusagereport'[Name], "Count login", [LoginCountPerUserMeasure] )
var currNum = SelectedValue(LoginCount[Value]) --capture the current rows login count
var final =COUNTROWS(FILTER(logintable, [Count login] = currNum)) --Filter the login to only people with that no of loginsRETURN finalThe -- are just comments to explain what the code is doing. You can delete these 🙂
Hi chetanpatel14 ,
To achieve your desired output, you need to group the users by their LoginCount and count how many users fall into each group. Here’s how you can achieve this in Power BI:
- Create a Calculated Table
Use the LoginCountPerUserMeasure to calculate the LoginCount for each user and then create a summary table. Write a DAX Table Calculation
Use the following DAX formula to create a new calculated table that groups the data and counts the number of users for each LoginCount:
LoginCountSummary =
SUMMARIZE(
ADDCOLUMNS(
DISTINCT('DateFilteredDailyUsageReport'[Name]),
"LoginCount", [LoginCountPerUserMeasure]
),
[LoginCount],
"Number of Users", COUNTROWS(VALUES('DateFilteredDailyUsageReport'[Name]))
)- Use the Table in a Visual
Add the new table LoginCountSummary to a table visual to display the results.
Output
The table visual should display:
| Login Count | Number Of Users |
| 19 | 5 |
| 20 | 4 |
This will dynamically reflect changes in the slicer selection. Let me know if you need further assistance!
If I have resolved your question, please consider marking my post as a solution. Thank you!
Above provided DAX is not working, I already validated. This will not respect the date range which user selected, it calculates the output for entire dataset from the sourcetable. It will not calculate based on the intermediate table which I created based on the date slicer