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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Ilse_ScpDt
Helper I
Helper I

Count of count

Hi,

 

I have a table with vacanies and applicants.

 

Vac Appl

1     A

1     B

1     C

2     D

3     E

3     F

4     G

 

I counted the number of Applicants per Vacany wth following formula (calculated column):

Count=
COUNTX(
      FILTER(
             ALL(Table),
              [Vac]=EARLIER([Vac])

      ),

     [Appl]

)

 

This results in:

Vac Appl Count

1     A        3

1     B        3

1     C        3

2     D        1

3     E         2

3     F         2

4     G        1

 

Now I would like to count the count so I can make a histogram. So i would like to see how many times there is 1 Applicant, how many times there are 2 Applicants, etc. Resulting in:

Vac Appl Count Count2

1     A        3         1

1     B        3         1

1     C        3         1

2     D        1         2

3     E         2         1

3     F         2         1

4     G        1         2

 

Hope you can help.

2 ACCEPTED SOLUTIONS

Hi,

Please check the below picture and the attached pbix file.

It is for creating measures.

 

Picture1.png

 

Count measure: =
VAR currentVAC =
MAX ( Data[Vac] )
VAR newtable =
FILTER ( ALL ( Data ), Data[Vac] = currentVAC )
RETURN
IF ( HASONEVALUE ( Data[Vac] ), COUNTROWS ( newtable ) )
 
Count2 measure: =
VAR currentCount = [Count measure:]
VAR newtable =
FILTER (
SUMMARIZE ( ALL ( data ), Data[Vac], Data[Count CC] ),
Data[Count CC] = currentCount
)
RETURN
COUNTROWS ( newtable )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Hi,

If you want to add slicer, please try to use ALLSELECTED function, instead of using ALL function.

Please check the attached file.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating new columns.

 

Picture1.png

 

Count CC =
VAR currentVAC = Data[Vac]
VAR newtable =
FILTER ( Data, Data[Vac] = currentVAC )
RETURN
COUNTROWS ( newtable )
 
Count2 CC =
VAR currentCount = Data[Count CC]
VAR newtable =
FILTER (
SUMMARIZE ( data, Data[Vac], Data[Count CC] ),
Data[Count CC] = currentCount
)
RETURN
COUNTROWS ( newtable )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi,

 

Thanks for the quick reply. It is working, but is it also possible to create a measure to count the count? Because I would like to filter the result on different variables from the table, but that (ofcourse) isnt working now. 

 

Kind regards,

Ilse

Hi,

Please check the below picture and the attached pbix file.

It is for creating measures.

 

Picture1.png

 

Count measure: =
VAR currentVAC =
MAX ( Data[Vac] )
VAR newtable =
FILTER ( ALL ( Data ), Data[Vac] = currentVAC )
RETURN
IF ( HASONEVALUE ( Data[Vac] ), COUNTROWS ( newtable ) )
 
Count2 measure: =
VAR currentCount = [Count measure:]
VAR newtable =
FILTER (
SUMMARIZE ( ALL ( data ), Data[Vac], Data[Count CC] ),
Data[Count CC] = currentCount
)
RETURN
COUNTROWS ( newtable )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

uHi,

 

This measure is working the same as the calculated column, it doesnt react right on a filter. 

 

I added a column Type to illustrate:

Ilse_ScpDt_0-1640773798311.png

When filtering on Type D (or B) you would like to see 1 for Count and 1 for Count2, but instead it will show 2 for Count2 (because that is the result for the total table):

Ilse_ScpDt_1-1640773962878.png

 

How can I make this work?

Hi,

If you want to add slicer, please try to use ALLSELECTED function, instead of using ALL function.

Please check the attached file.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors