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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
n00ne
Helper I
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:

n00ne_2-1674666534462.png

 

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,

Adrian

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

vxinruzhumsft_0-1674804851431.png

 

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.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

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.

vxinruzhumsft_0-1674804851431.png

 

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.

Greg_Deckler
Super User
Super User

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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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

@Greg_Deckler any idea how to solve this, please?

n00ne
Helper I
Helper I

Hi again,

 

Just wanted to support you with raw data.

IDM/FPosition
1F 
2F11
3M11
4F12
5F12
6M13
7M13
8F14
9M14
10M14
11M14
12F14
13F14
14F14
15M15
16M15
17M15
18M15
19M15
20F15
21M15
22M15
23M16
24M16
25M16
26M16
27M16
28F16
29M16
30M16
31M16
32M16
33F16
34M16
35F16
36M16
37M16
38M16
39F16
40M16
41M16
42M16
43M16
44F16
45M16
46M16
47M16
48M16
49M16
50M16
51M16
52M17
53M17
54F17
55M17
56M17
57F17
58M17
59M18
60M18
61M18
62M18
63F19
64M19
65M20

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors