Forum Discussion
chetanpatel14
1 year agoNew Member
Summarize the Measure output
In Power Bi, I have a 'public dailyusagereport' with 2 columns called "Name" and "LastLoginDate". My input table as data from Aug 2023 to 6th Nov2024 1.I have provided the date range in the slicer o...
- 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 🙂
SamWiseOwl
1 year agoSuper User
It 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 no
SUMMARIZE('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 logins
RETURN final
The -- are just comments to explain what the code is doing. You can delete these 🙂
chetanpatel14
1 year agoNew Member
Hi, Thanks for your solution it worked. I did below steps
1. Created new table
LoginCount = GenerateSeries(1,100,1)
2. Created new measure with below DAX
UserCountByLoginCount =
VAR logintable =
SUMMARIZE(
'DateFilteredDailyUsageReport',
'DateFilteredDailyUsageReport'[Name],
"CountLogin", [LoginCountPerUserMeasure]
)
VAR currNum = SelectedValue(LoginCount[Value])
VAR result =
COUNTROWS(FILTER(logintable, [Countlogin] = currNum))
RETURN result
3. In the clustered column chart, dragged the value field from the LoginCount table and added UserCountByLoginCount from the DateFilteredDailyUsageReport table. It is displaying the output as expected
Thanks again for your response.