This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Hello,
I have a simple excel sheets with names and dates when they logged in an application.
I need to keep (count) only their first log-in, delete the rest (or keep, but just count the first login).
Result will be a stacked column chart: Number of log-ins and month+year.
Could anyone please help?
Thank you!!
| Name | Logged in | Result |
| Anna | 26/8/2020 | keep |
| Anna | 29/8/2020 | delete |
| Albert | 01/08/2020 | keep |
| Anna | 31/8/2020 | delete |
| Cecile | 01/01/2020 | keep |
Solved! Go to Solution.
In Query Editor, try the Group By Feature -> Advanced to Select the MIN Login (by Email) and COUNT of Rows.
After that, you can take the GROUPED DATA into a simple chart.
Proud to give back to the community!
Thank You!
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Logged in", type datetime}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"Name", Order.Ascending}, {"Logged in", Order.Ascending}}),
Partition = Table.Group(#"Sorted Rows", {"Name"}, {{"Partition", each Table.AddIndexColumn(_, "Index",1,1), type table}}),
#"Expanded Partition" = Table.ExpandTableColumn(Partition, "Partition", {"Logged in", "Index"}, {"Logged in", "Index"}),
#"Added Custom" = Table.AddColumn(#"Expanded Partition", "Action", each if [Index]=1 then "Keep" else "Delete"),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"
If you do not want to Load the "Delete" rows to your Data Model, then you can simply filter out those values.
Hope this helps.
In Query Editor, try the Group By Feature -> Advanced to Select the MIN Login (by Email) and COUNT of Rows.
After that, you can take the GROUPED DATA into a simple chart.
Proud to give back to the community!
Thank You!
@KatkaS - Seems like:
Measure =
VAR __Month = MAX('Calendar'[Month])
VAR __Year = MAX('Calendar'[Year])
VAR __Table = SUMMARIZE(ALL('Table'),[Name],"First",MIN([Logged in]))
RETURN
COUNTROWS(FILTER(__Table,YEAR([First])=__Year && MONTH([First])=__Month))
Thank you, Greg, but I'm afraid this is too advanced for me. You mentioned MAX('Calendar'[Month])
- do I need to create new table with periods and create relationship between the User login table..?
@KatkaS , not very clear. Do we need to calculate first log in (Logic)
calculate(countrows(table),filter(table, table[Result] in{"delete","First log in"}))
Thank you, Amit. I tried your measure, but I don't understand what you mean by in{"delete","First log in"})) - do I need to add new column "First log in"..?
And yes, we need to count how many new logins were every month - month are on X axis of a stacked column chart..
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 25 | |
| 23 | |
| 19 | |
| 17 | |
| 14 |
| User | Count |
|---|---|
| 24 | |
| 23 | |
| 20 | |
| 20 | |
| 19 |