DAX IF Statement

legalhustler

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

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

legalhustler

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

Watch MrExcel Video

Forum statistics

Threads
1,109,507
Messages
5,529,268
Members
409,859
Latest member
emperorgenghiskhan
Top