DAX IF Statement

legalhustler

Well-known Member
Joined
Jun 5, 2014
Messages
1,160
Office Version
  1. 365
Platform
  1. Windows
I have a Power Pivot column called "Timeliness" that has values such as After 2/1/2018, Before 2/1/2018, After 3/1/2018, Before 3/1/2018.

How do I create a IF statement that counts the rows for all the one's that are for After?

The Excel formula would be like =COUNTIFS($A$1:$A$5,"After*"), which would result in 2. But I'm not sure how to do it in DAX (since there is no COUNTIFS function). Should the DAX formula be in a Calculated Column or Measure?
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I figured it out! I used the below DAX formula in a measure. It wasn't the IF but the CALCULATE function that I needed to use.

:=CALCULATE(COUNTROWS('TableName'),FILTER('TableName',FIND("After",'TableName'[ColumnName],1,0)>0)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,306
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top