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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
amittal1
Regular Visitor

Count if in dax

Active_controlled = CALCULATE(COUNT('Sheet1 (2)'[placebo]), 'Sheet1 (2)'[placebo]=="Active-control trial")
 
 
This is my DAX formula  for measure Active_controlled that I have used, but its returning blank. I was trying to count the number of times Active-control trial is appearing in the column placebo in sheet - Sheet1 (2). Please help what can be done for this.
2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@amittal1 , Try using below DAX

 

Active_controlled = CALCULATE(
COUNT('Sheet1 (2)'[placebo]),
FILTER('Sheet1 (2)', 'Sheet1 (2)'[placebo] = "Active-control trial")
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @amittal1 ,

 

I tested the measure of bhanu_gautam  and it works fine.
Here's my test data:

vtangjiemsft_0-1726644282838.png

Output:

vtangjiemsft_1-1726644305181.png

 

As dharmendars007 mentioned, did you apply a filter or did you use a slicer? You can create a table visual, place it on the same page as the card visual, and see if the output is correct.

vtangjiemsft_2-1726644365792.png

 

 

Best Regards,

Neeko Tang

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

6 REPLIES 6
Anonymous
Not applicable

Hi @amittal1 ,

 

I tested the measure of bhanu_gautam  and it works fine.
Here's my test data:

vtangjiemsft_0-1726644282838.png

Output:

vtangjiemsft_1-1726644305181.png

 

As dharmendars007 mentioned, did you apply a filter or did you use a slicer? You can create a table visual, place it on the same page as the card visual, and see if the output is correct.

vtangjiemsft_2-1726644365792.png

 

 

Best Regards,

Neeko Tang

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

Hi @Anonymous , thanks for your care. I used a card for another value as well from the same column, may be that's the reason I am unable to do it for another value from the same column. So, I instead used slicer to show the total count. And, yes as you have tested bhanu's method I will mark it as an answer.

bhanu_gautam
Super User
Super User

@amittal1 , Try using below DAX

 

Active_controlled = CALCULATE(
COUNT('Sheet1 (2)'[placebo]),
FILTER('Sheet1 (2)', 'Sheet1 (2)'[placebo] = "Active-control trial")
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi  bhanu, thanks for you answer, but this is again showing blank in the card. Just one thing to ask you, can we create more than one measure using a column, i think yes right, so I created this measure for the column values with placebo-control trial, that worked, but for active-control trial it didnt worked, dont know why.

Hello @amittal1 , 

 

Please check if there is values for filter "active-control trial" in the table and also check if ther are any page level filters.

 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

Hi @dharmendars007, thanks for your reply, I used a slicer instead, I think the problem was arising may be because I used a card already for another value(Placebp control trial) in the same column (placebo), and there might be something preventing me to use another card for the same column with different value.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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