cancel
Showing results for
Did you mean:
Helper I

## Total of numbers based on filters

Dear All,

I got another ask to our community.

I am trying to figure out dax calculations to resolve below table:

I got positions for employees and gender. Second column shows total numer of male and female (which is also provided for each row). Third column shows total number of employees for only positions where number of males >=2 and number of females =>2. At this point I got problem. I cannot achieve 4th column which is sum of 3rd column for all grades which pass above conditions (Male>=2 and Female>=2). Using in dax formula function ALL cause that in return I am getting total of second column (regardless males and felames condition).

I would be much appreciated for your help.

BR,

1 ACCEPTED SOLUTION
Community Support

Hi @n00ne

You can try the following measure:

``Total cnt = IF([cn filter]<>BLANK(),COUNTROWS(FILTER(ALLSELECTED('Table'),[cn filter]<>BLANK())))``

[cn filter] and [cn all] are both measures.

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 REPLIES 4
Community Support

Hi @n00ne

You can try the following measure:

``Total cnt = IF([cn filter]<>BLANK(),COUNTROWS(FILTER(ALLSELECTED('Table'),[cn filter]<>BLANK())))``

[cn filter] and [cn all] are both measures.

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User

@n00ne What should be Total cnt column be for those rows if not 43?

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Helper I

43 is corrent. The only problem is what calculation should I use to get it?

@Greg_Deckler any idea how to solve this, please?

Helper I

Hi again,

Just wanted to support you with raw data.

 ID M/F Position 1 F 2 F 11 3 M 11 4 F 12 5 F 12 6 M 13 7 M 13 8 F 14 9 M 14 10 M 14 11 M 14 12 F 14 13 F 14 14 F 14 15 M 15 16 M 15 17 M 15 18 M 15 19 M 15 20 F 15 21 M 15 22 M 15 23 M 16 24 M 16 25 M 16 26 M 16 27 M 16 28 F 16 29 M 16 30 M 16 31 M 16 32 M 16 33 F 16 34 M 16 35 F 16 36 M 16 37 M 16 38 M 16 39 F 16 40 M 16 41 M 16 42 M 16 43 M 16 44 F 16 45 M 16 46 M 16 47 M 16 48 M 16 49 M 16 50 M 16 51 M 16 52 M 17 53 M 17 54 F 17 55 M 17 56 M 17 57 F 17 58 M 17 59 M 18 60 M 18 61 M 18 62 M 18 63 F 19 64 M 19 65 M 20