Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I am trying to come up with DAX formula that goes like this:
If some condition is met, count as 1.
But if some other condition is met, count as 0.
How do we go about doing it?
Do we have to use VAR for each outcome and possibly subtract the each value (1 - 1 = 0)?
Bottom is graphic illustration:
Step1 = CALCULATE (
DISTINCTCOUNT( Table[ClientID] ),
(Table[Step] = 1 &&
Not(Table[Consent] = "Refused") &&
NOT(ISBLANK(Table[Consent]))
)
Overwrite as Count 0 if bottom condition is met:
(
Table[Step] = 1 &&
NOT(Table[Consent] = "Not Eligible")
)
)
Solved! Go to Solution.
@JustinDoh1 Maybe:
Column =
VAR Step1 = CALCULATE (
DISTINCTCOUNT( Table[ClientID] ),
(Table[Step] = 1 &&
Not(Table[Consent] = "Refused") &&
NOT(ISBLANK(Table[Consent]))
)
RETURN
IF(Table[Step] = 1 && NOT(Table[Consent] = "Not Eligible"),0,Step1)
@JustinDoh1 That's just because you must have written a measure and the formula I wrote was for a column, hence why I called it column. SELECTEDVALUE will work although I tend to use MAX or MIN. But, remember, this is going to depend heavily on context for the measure to work properly.
@JustinDoh1 Maybe:
Column =
VAR Step1 = CALCULATE (
DISTINCTCOUNT( Table[ClientID] ),
(Table[Step] = 1 &&
Not(Table[Consent] = "Refused") &&
NOT(ISBLANK(Table[Consent]))
)
RETURN
IF(Table[Step] = 1 && NOT(Table[Consent] = "Not Eligible"),0,Step1)
@Greg_Deckler I have a question for you.
Your code was great, but I had to add "SelectedValue" or it appears that I had to aggregate to get rid of error. How do I fix to select only one value? Because error was gone, but I don't think my logic goes thru though. Thanks.
@JustinDoh1 That's just because you must have written a measure and the formula I wrote was for a column, hence why I called it column. SELECTEDVALUE will work although I tend to use MAX or MIN. But, remember, this is going to depend heavily on context for the measure to work properly.
User | Count |
---|---|
12 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
19 | |
14 | |
10 | |
7 |