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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Dax Calc countif

I need help figuring out how to write this formula in dax. 

 

COUNT IF [F RETAIL FH FIRST/FURTHER] = "FIRST" OR "FURTHER"

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Text is not computable for aggregation, I think you need to convert the data type first.

Through here to change the data type:

vmengzhumsft_0-1669792890632.png

and then you can do some calculation.

Refer to my pbix file for better understanding.

 

Best regards,

Community Support Team Selina 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

9 REPLIES 9
ERD
Community Champion
Community Champion

@Anonymous ,

You can try the measure below:

your_measure =
IF (
    'F RETAIL FH FIRST'[FURTHER] IN { "FIRST", "FURTHER" },
    COUNT ( 'F RETAIL FH FIRST'[FURTHER] )
)

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

Thanks for the answer, but that syntax does not work.

ERD
Community Champion
Community Champion

What's the error?

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

I dont think and if will work for dax.  I am just looking to COUNT [F RETAIL FH FIRST/FURTHER] when its  = to "FIRST" OR "FURTHER"

ERD
Community Champion
Community Champion

Ok, here is another option:

your_measure =
CALCULATE (
    COUNT ( 'F RETAIL FH FIRST'[FURTHER] ),
    'F RETAIL FH FIRST'[FURTHER] IN { "FIRST", "FURTHER" }
)

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

Thats not getting me the answer I need.  below is the calc I am trying to convert from qlik to pbi.  The RTL_First_further is text if that helps.

sum(if(RTL_FIRST_FURTHER = 'FIRST',1,
if(RTL_FIRST_FURTHER = 'FURTHER' ,1,null())))

Anonymous
Not applicable

Hi @Anonymous ,

 

What is the logic you are trying to convey? 

My idea: This is your filtering criteria F RETAIL FH FIRST[FURTHER] = "FIRST" or "FURTHER". 

When this condition is met, you need to count or sum some data? Is this what you have in mind?

 

Best regards,

Community Support Team Selina zhu

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

Anonymous
Not applicable

Hi,

 

Yes that is exactly what I have in mind.  I just need the sum of F RETAIL FH FIRST[FURTHER] after the condition is met, but I have diffucutlties because it is text. 

 

Thanks.

Anonymous
Not applicable

Hi @Anonymous ,

 

Text is not computable for aggregation, I think you need to convert the data type first.

Through here to change the data type:

vmengzhumsft_0-1669792890632.png

and then you can do some calculation.

Refer to my pbix file for better understanding.

 

Best regards,

Community Support Team Selina zhu

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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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