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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Afaque_Eclerx
Frequent Visitor

Dax to get countifs value as im getting in excel

Hi Team,

 

In excel im using formula like =COUNTIFS(O:O,O2,M:M,"in stock") and  COUNTIFS(A:A,A2,M:M,"in stock") Kindly let me know how can I replicae the same in Power BI.

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Hi @Afaque_Eclerx ,

 

Firstly, I suggest you to add an index column in Power BI, due to the calculation in Power BI is based on column.

RicoZhou_0-1678693311616.png

Convert =COUNTIFS(O:O,O2,M:M,"in stock") to a measure:

Countif = 
VAR _O2 = CALCULATE(MAX('Table'[O]),'Table'[Index] = 1)
return
CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[O] = _O2 && 'Table'[M] = "in stock"))

My Sample:

RicoZhou_1-1678693565643.png

Result is as below.

RicoZhou_2-1678693572508.png

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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