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
If you mean this bit:
var logintable = --Create a virtual version of your table, calc for each person their login no
SUMMARIZE('logintable ','logintable'[Name], "Count login", [LoginCountPerUserMeasure] )
The -- is a comment letting you know what the SUMMARIZE function is doing.
So it is going to your table 'public dailyusagereport' and for each name performing the measure you made. Replace LoginTable with the name of your table.
chetanpatel14
1 year agoNew Member
Hi,
Thanks for your quick response, I already created the table with the series, What I asked is I didn't understood the below code.
Count Logins=
var logintable = --Create a virtual version of your table, calc for each person their login no
SUMMARIZE('logintable ','logintable'[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
Thanks
- SamWiseOwl1 year agoSuper UserIt 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 🙂- chetanpatel141 year agoNew Member
Hi, Thanks for your solution it worked. I did below steps
1. Created new tableLoginCount = GenerateSeries(1,100,1)2. Created new measure with below DAXUserCountByLoginCount =VAR logintable =SUMMARIZE('DateFilteredDailyUsageReport','DateFilteredDailyUsageReport'[Name],"CountLogin", [LoginCountPerUserMeasure])VAR currNum = SelectedValue(LoginCount[Value])VAR result =COUNTROWS(FILTER(logintable, [Countlogin] = currNum))RETURN result3. 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 expectedThanks again for your response.