• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to apply Countifs formula in Power BI

Pankaj Mishra

New Member
Hi Team,

How to apply countifs formula in Power BI (Using DAX/Power Query/M-Code etc.).

Below is the formula in excel and I want to apply same in power BI.

Checking the condition from different Dimension with multiple condition and count the value in Fact Diimension.

=COUNTIFS('Stage 1'!$D$2:$D$83,"<"&'Stage 2'!A2,'Stage 1'!$E$2:$E$83,">"&'Stage 2'!A2)

Regards,
Pankaj Mishra
 
To apply the COUNTIFS formula in Power BI, you can use the DAX function "COUNTROWS" with a filter function such as "FILTER" or "CALCULATETABLE". Here's an example of how you can use DAX to replicate the Excel formula:


=CALCULATE(COUNTROWS('Fact Dimension'),
FILTER('Stage 1', 'Stage 1'[ColumnD] < MAX('Stage 2'[ColumnA]) && 'Stage 1'[ColumnE] > MAX('Stage 2'[ColumnA]))
)
 
Back
Top