Forum Discussion
romoguy15
Helper IV
5 years agoDistinct Count # of unique dates based on column with duplicates
Hello Everyone, I have a two column table, one with ticket IDs and another with dates. The first column of ticket IDs could have uniqe or duplicate ticket IDs. The other date column could have al...
- 5 years ago
Hi,
This should typically be done directly in the visual but if you must do it in the Query Editor, then this M code works
let Source = Excel.Workbook(File.Contents("C:\Users\mathu\Desktop\try.xlsx"), null, true), #"Removed Other Columns" = Table.SelectColumns(Source,{"Data"}), #"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"Column1", "Column2"}, {"Data.Column1", "Data.Column2"}), #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Ticket Id", type text}, {"Ticket Closed Date", type date}}), #"Sorted Rows" = Table.Sort(#"Changed Type",{{"Ticket Id", Order.Ascending}}), #"Grouped Rows" = Table.Group(#"Sorted Rows", {"Ticket Id"}, {{"Count", each Table.RowCount(Table.Distinct(_)), type nullable date}}) in #"Grouped Rows"
C2
3 years agoFrequent Visitor
what if I have a visual with a Signout Date on X axis & count distinct fo Loads on Y axis, how do I do to be able to add a line to shows the distinct count of loads scheduled for for that same date of signt out, being that if I put the Loads column on the Line Y field it will show the count of the Loads that were signed out, please note that scheduled date is one column & signout its another.
- Ashish_Mathur3 years ago
Super User
Hi,
Share some data, explain the question and show the expected result.