The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Dear All,
I am trying to fetch the result of number of times batsman dismissed as per below table
Batsman | Non-Striker | Batsman_Runs | Wicket_Type | Player_Dismissed |
JE Root | BA Stokes | 1 | caught | JE Root |
JE Root | BA Stokes | 2 | caught | JE Root |
JE Root | BA Stokes | 4 | bowled | JE Root |
BA Stokes | JE Root | 2 | run out | JE Root |
HC Brook | JE Root | 1 | bowled | HC Brook |
HC Brook | BA Stokes | 6 | run out | BA Stokes |
HC Brook | OJ Pope | 3 | caught | HC 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.
I am attaching the sample PBIX file.
https://drive.google.com/file/d/1uWqn2PR5WEQU2Dfz73AfG03KURkkmD_u/view?usp=drive_link
Regards,
Sandeep
Solved! Go to Solution.
@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.
@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.
User | Count |
---|---|
12 | |
11 | |
8 | |
7 | |
7 |
User | Count |
---|---|
22 | |
19 | |
12 | |
11 | |
7 |