DAX IF Statement

legalhustler

Well-known Member
Joined
Jun 5, 2014
Messages
1,171
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,214,976
Messages
6,122,543
Members
449,089
Latest member
davidcom

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