cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

DAX function related Issue

Hi,

 

I am using Cricket related data for one of my report. I would like to find out Maximum Strike Rate batsmans with more than 100 runs.  I am using below formula

 

Best Strike Rate =
var temp = FILTER(
SUMMARIZE(deliveries,
deliveries[match_id],
deliveries[Batsman],
"StrikeRate", 100* SUM(deliveries[batsman_runs])/COUNT(deliveries[Batsman])
),SUM(deliveries[batsman_runs]) >= 100)
return
MAXX(temp, [StrikeRate])

 

 

It's showing total strike rate & not the max stike rate. Kindly advise. Attached screenshot for your reference.

 

Capture.JPG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: DAX function related Issue

Hi @ajinkya1907

 

How about this one?

 

Best Strike Rate =
VAR temp =
    FILTER (
        SUMMARIZE (
            deliveries,
            deliveries[match_id],
            deliveries[Batsman],
            "StrikeRate", 100 * SUM ( deliveries[batsman_runs] )
                / COUNT ( deliveries[Batsman] )
        ),
        CALCULATE ( SUM ( deliveries[batsman_runs] ) ) >= 100
    )
RETURN
    MAXX ( temp, [StrikeRate] )
Regards,
Zubair


View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: DAX function related Issue

Hi @ajinkya1907

 

How about this one?

 

Best Strike Rate =
VAR temp =
    FILTER (
        SUMMARIZE (
            deliveries,
            deliveries[match_id],
            deliveries[Batsman],
            "StrikeRate", 100 * SUM ( deliveries[batsman_runs] )
                / COUNT ( deliveries[Batsman] )
        ),
        CALCULATE ( SUM ( deliveries[batsman_runs] ) ) >= 100
    )
RETURN
    MAXX ( temp, [StrikeRate] )
Regards,
Zubair


View solution in original post

Highlighted
Helper II
Helper II

Re: DAX function related Issue

Well That works just fine. @Zubair_Muhammad, I am your fan buddy.

 

Could you please explain why calculate function made the difference? I am not able to understand that part. 

Highlighted
Super User III
Super User III

Re: DAX function related Issue

Hi @ajinkya1907

 

Wow I have 2 fans now... Other is my 3 year old son

 

Actually FILTER function is an ITERATOR.... it creates a ROW context and not a FILTER context

 

thats why you have to use Calculate

Regards,
Zubair


Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors