Forum Discussion
Anonymous
8 years agoNot applicable
DAX for MIn/Max based on count
Hello All, Need hep! I need to dispay (on card tile) min and max hour when the count of crime is min and max. Hour is on x axis and crime # on y axis. In this example I need to dispay max time as...
- 8 years ago
Hi Anonymous
Check this file here
Try this
Time_MaxCrime = VAR MaxCount = MAXX ( VALUES ( Table1[Time] ), CALCULATE ( COUNT ( Table1[Crime Type] ) ) ) RETURN CALCULATE ( CONCATENATEX ( FILTER ( VALUES ( Table1[Time] ), CALCULATE ( COUNT ( Table1[Crime Type] ) = MaxCount ) ), Table1[Time] ) )
Zubair_Muhammad
8 years agoCommunity Champion
Hi Anonymous
See if this helps
MinCrime =
VAR MinCount =
MINX ( ALL ( Table1[Time] ), CALCULATE ( COUNT ( Table1[Crime Type] ) ) )
RETURN
CALCULATE (
CONCATENATEX (
FILTER (
ALL ( Table1[Time] ),
CALCULATE ( COUNT ( Table1[Crime Type] ) ) = BLANK ()
|| CALCULATE ( COUNT ( Table1[Crime Type] ) ) = 0
|| CALCULATE ( COUNT ( Table1[Crime Type] ) = MinCount )
),
Table1[Time],
", "
)
)Anonymous
8 years agoNot applicable
Hi Zubair,
This is so excellent that I don't know how to thank you! :) Only problem with this Min function that it doen't show any value initially i.e. when no crime is manually selected (that means all crimes are selected by default). It works fine when I manually select any one crime. But the MAX function is working perfectly in any case.
Do you have any idea what could be the problem?
I really appreciate all your efforts.
Thank you Zubair !
- Zubair_Muhammad8 years agoCommunity ChampionCould you share the file?
- Anonymous8 years agoNot applicable
I am not sure how can I share the file here. Also is there any way I can share file just to you? Please let me know.
Thanks!