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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-xinruzhu-msft
Community Support
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.

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
v-xinruzhu-msft
Community Support
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.

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!:
The Definitive Guide to Power Query (M)

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.