Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sdm2211
Frequent Visitor

Filter not giving correct result.

Dear All,

I am trying to fetch the result of number of times batsman dismissed as per below table

BatsmanNon-StrikerBatsman_RunsWicket_TypePlayer_Dismissed
JE RootBA Stokes1caughtJE Root
JE RootBA Stokes2caughtJE Root
JE RootBA Stokes4bowledJE Root
BA StokesJE Root2run outJE Root
HC BrookJE Root1bowledHC Brook
HC BrookBA Stokes6run outBA Stokes
HC BrookOJ Pope3caughtHC Brook

 

here the concentration should be on column "Player_Dismissed" and It should show the count of no. of dismissed should be as follows;

JE Root - 4

HC Brook - 2 times

BA Stokes - 1 time.

 

However I am getting a following result with the DAX formula used. so basically it is counting only column "Batsman" I knw it is faulty DAX formula. Could anyone please help me to rectify the DAX.

sdm2211_1-1738150913717.png

I am attaching the sample PBIX file.

https://drive.google.com/file/d/1uWqn2PR5WEQU2Dfz73AfG03KURkkmD_u/view?usp=drive_link 

 

Regards,

Sandeep 

 

 

 

1 ACCEPTED SOLUTION
mark_endicott
Super User
Super User

@sdm2211 - Use the below:

 

Out = 
VAR _name =
    SELECTEDVALUE ( TEST[Batsman] )
RETURN
    CALCULATE ( COUNTROWS ( TEST ), TEST[Player_Dismissed] = _name, ALL ( TEST ) )

 

See attached for results. 

 

If this works, please accept as the solution to help others with the same challenge. 

View solution in original post

1 REPLY 1
mark_endicott
Super User
Super User

@sdm2211 - Use the below:

 

Out = 
VAR _name =
    SELECTEDVALUE ( TEST[Batsman] )
RETURN
    CALCULATE ( COUNTROWS ( TEST ), TEST[Player_Dismissed] = _name, ALL ( TEST ) )

 

See attached for results. 

 

If this works, please accept as the solution to help others with the same challenge. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.