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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
equevedo84
Frequent Visitor

Recreating COUNTIF formula into Measure in Power BI

Hey everyone,

 

I'm transitioning an Excel report into Power BI and want to adapt a COUNTIFS formula in the Excel report into a Power BI measure.  The current COUNTIFS formula reads as follows: =COUNTIFS($K:$K,"Non-Compliant",$J:$J,$J2,$H:$H,$H2,$A:$A,$A2).  K column is a Status column which has only two values Compliant or Non-Compliant.  Column J is a Measure column containing text of different Measure descriptions, column H contains doctor names, and column A contains insurance names.  The formula is obviously counting the occurrence of the Status Compliant or Non-Compliant in the given three way combo of Measure/Doctor/Insurance name, so one doctor that is paired with a given measure description and insurance that is Non-Compliant is counted occurrence of 11x.  Any help is greatly appreciated.

 

Thanks

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Substitute your own column/table names. This is a calculated column.

ColumnNonCompliant = 
var _Payer = TableT[Column1]
var _Prov =  TableT[Column2]
var _Meas = TableT[Column3]
var _stat = TableT[Status]

RETURN
COUNTROWS(FILTER(TableT, TableT[Column1] = _Payer && TableT[Column2] = _Prov && TableT[Column3] = _Meas && TableT[Status] = "Compliant"))

 Post your data next time please, not a picture

View solution in original post

7 REPLIES 7
HotChilli
Super User
Super User

No problem. Let me know how it works for you.

--

For posting on the forum:

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-... 

HotChilli
Super User
Super User

Substitute your own column/table names. This is a calculated column.

ColumnNonCompliant = 
var _Payer = TableT[Column1]
var _Prov =  TableT[Column2]
var _Meas = TableT[Column3]
var _stat = TableT[Status]

RETURN
COUNTROWS(FILTER(TableT, TableT[Column1] = _Payer && TableT[Column2] = _Prov && TableT[Column3] = _Meas && TableT[Status] = "Compliant"))

 Post your data next time please, not a picture

Worked just like I wanted it, thanks!

Thank you very much for your response.  I tried to post the data sample as an attachment but could not find a button or option for file attachment.

equevedo84
Frequent Visitor

Screen Shot of original Excel:

 

equevedo84_0-1714578207245.png

HotChilli
Super User
Super User

You will get a quicker answer if you post a small, fake data sample and show the desired result.

equevedo84_0-1714592052910.png

 

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.