Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi All,
I want to write a DAX expression to return the time from the maximum count of rows.
So as per below it would be 17:00.
My best attempt. This is returning the wrong answer at 19:00 currently
Solved! Go to Solution.
Try these measures. The concept is to rank [Count Rows] (a measure) in a virtual table, and then filter the virtual table for the top-ranked row.
Count Rows = COUNT ( 'Bike & Pedestrian Data'[ID] )
MaxTimeCount =
VAR vBaseTable =
ADDCOLUMNS (
SUMMARIZE (
'Bike & Pedestrian Data',
'Bike & Pedestrian Data'[TimeExtract (bins)],
'Bike & Pedestrian Data'[Transport Type]
),
"@CountRows", [Count Rows]
)
VAR vRankTable =
ADDCOLUMNS (
vBaseTable,
"@Rank", RANKX ( vBaseTable, [@CountRows],, DESC, DENSE )
)
VAR vTopRank =
FILTER ( vRankTable, [@Rank] = 1 )
VAR vResult =
MAXX ( vTopRank, 'Bike & Pedestrian Data'[TimeExtract (bins)] )
RETURN
vResult
Proud to be a Super User!
Worked a charm thank you very much
Try these measures. The concept is to rank [Count Rows] (a measure) in a virtual table, and then filter the virtual table for the top-ranked row.
Count Rows = COUNT ( 'Bike & Pedestrian Data'[ID] )
MaxTimeCount =
VAR vBaseTable =
ADDCOLUMNS (
SUMMARIZE (
'Bike & Pedestrian Data',
'Bike & Pedestrian Data'[TimeExtract (bins)],
'Bike & Pedestrian Data'[Transport Type]
),
"@CountRows", [Count Rows]
)
VAR vRankTable =
ADDCOLUMNS (
vBaseTable,
"@Rank", RANKX ( vBaseTable, [@CountRows],, DESC, DENSE )
)
VAR vTopRank =
FILTER ( vRankTable, [@Rank] = 1 )
VAR vResult =
MAXX ( vTopRank, 'Bike & Pedestrian Data'[TimeExtract (bins)] )
RETURN
vResult
Proud to be a Super User!
User | Count |
---|---|
65 | |
60 | |
47 | |
33 | |
32 |
User | Count |
---|---|
85 | |
75 | |
56 | |
50 | |
45 |